John Smith
commited on
Commit
·
6c9ae63
1
Parent(s):
2698027
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ last_file = None
|
|
14 |
img_mode = "RGBA"
|
15 |
|
16 |
|
17 |
-
def realesrgan(img, model_name, denoise_strength, face_enhance, outscale):
|
18 |
"""Real-ESRGAN function to restore (and upscale) images.
|
19 |
"""
|
20 |
if not img:
|
@@ -105,7 +105,7 @@ def realesrgan(img, model_name, denoise_strength, face_enhance, outscale):
|
|
105 |
extension = 'jpg'
|
106 |
|
107 |
#out_filename = f"output_{rnd_string(8)}.{extension}"
|
108 |
-
out_filename = f"output_{rnd_string(8)}.
|
109 |
cv2.imwrite(out_filename, output)
|
110 |
global last_file
|
111 |
last_file = out_filename
|
@@ -190,6 +190,9 @@ def main():
|
|
190 |
minimum=1, maximum=10, step=1, value=4, show_label=True)
|
191 |
face_enhance = gr.Checkbox(label="Face Enhancement using GFPGAN (Doesn't work for anime images)",
|
192 |
value=False, show_label=True)
|
|
|
|
|
|
|
193 |
|
194 |
with gr.Row():
|
195 |
with gr.Group():
|
@@ -202,7 +205,7 @@ def main():
|
|
202 |
# Event listeners:
|
203 |
input_image.change(fn=image_properties, inputs=input_image, outputs=input_image_properties)
|
204 |
restore_btn.click(fn=realesrgan,
|
205 |
-
inputs=[input_image, model_name, denoise_strength, face_enhance, outscale],
|
206 |
outputs=output_image,
|
207 |
api_name="upscale")
|
208 |
|
|
|
14 |
img_mode = "RGBA"
|
15 |
|
16 |
|
17 |
+
def realesrgan(img, model_name, denoise_strength, face_enhance, outscale, ext):
|
18 |
"""Real-ESRGAN function to restore (and upscale) images.
|
19 |
"""
|
20 |
if not img:
|
|
|
105 |
extension = 'jpg'
|
106 |
|
107 |
#out_filename = f"output_{rnd_string(8)}.{extension}"
|
108 |
+
out_filename = f"output_{rnd_string(8)}." + ext
|
109 |
cv2.imwrite(out_filename, output)
|
110 |
global last_file
|
111 |
last_file = out_filename
|
|
|
190 |
minimum=1, maximum=10, step=1, value=4, show_label=True)
|
191 |
face_enhance = gr.Checkbox(label="Face Enhancement using GFPGAN (Doesn't work for anime images)",
|
192 |
value=False, show_label=True)
|
193 |
+
ext = gr.Dropdown(label="Output Ext",
|
194 |
+
choices=["png", "jpg"],
|
195 |
+
value="png", show_label=True)
|
196 |
|
197 |
with gr.Row():
|
198 |
with gr.Group():
|
|
|
205 |
# Event listeners:
|
206 |
input_image.change(fn=image_properties, inputs=input_image, outputs=input_image_properties)
|
207 |
restore_btn.click(fn=realesrgan,
|
208 |
+
inputs=[input_image, model_name, denoise_strength, face_enhance, outscale, ext],
|
209 |
outputs=output_image,
|
210 |
api_name="upscale")
|
211 |
|