Update app.py
Browse files
app.py
CHANGED
|
@@ -43,7 +43,7 @@ def rnd_string(x): return "".join(random.choice("abcdefghijklmnopqrstuvwxyz_0123
|
|
| 43 |
|
| 44 |
|
| 45 |
def get_model_and_paths(model_name, denoise_strength):
|
| 46 |
-
|
| 47 |
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
|
| 48 |
netscale = 4
|
| 49 |
file_url = ['https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth'] \
|
|
@@ -58,7 +58,7 @@ def get_model_and_paths(model_name, denoise_strength):
|
|
| 58 |
netscale = 2
|
| 59 |
file_url = ['https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth']
|
| 60 |
elif model_name == 'realesr-general-x4v3':
|
| 61 |
-
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=
|
| 62 |
netscale = 4
|
| 63 |
file_url = [
|
| 64 |
'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth',
|
|
@@ -582,7 +582,7 @@ def infer(
|
|
| 582 |
true_cfg_scale=true_guidance_scale,
|
| 583 |
num_images_per_prompt=num_images_per_prompt,
|
| 584 |
).images
|
| 585 |
-
upscaled = realesrgan(image, "realesr-general-x4v3", 0.5)
|
| 586 |
# Return images, seed, and make button visible
|
| 587 |
return upscaled, seed, gr.update(visible=True), gr.update(visible=True)
|
| 588 |
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
def get_model_and_paths(model_name, denoise_strength):
|
| 46 |
+
if model_name in ('RealESRGAN_x4plus', 'RealESRNet_x4plus'):
|
| 47 |
model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32, scale=4)
|
| 48 |
netscale = 4
|
| 49 |
file_url = ['https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth'] \
|
|
|
|
| 58 |
netscale = 2
|
| 59 |
file_url = ['https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth']
|
| 60 |
elif model_name == 'realesr-general-x4v3':
|
| 61 |
+
model = SRVGGNetCompact(num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=32, upscale=4, act_type='prelu')
|
| 62 |
netscale = 4
|
| 63 |
file_url = [
|
| 64 |
'https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth',
|
|
|
|
| 582 |
true_cfg_scale=true_guidance_scale,
|
| 583 |
num_images_per_prompt=num_images_per_prompt,
|
| 584 |
).images
|
| 585 |
+
upscaled = realesrgan(image, "realesr-general-x4v3", 0.5,2)
|
| 586 |
# Return images, seed, and make button visible
|
| 587 |
return upscaled, seed, gr.update(visible=True), gr.update(visible=True)
|
| 588 |
|