Update app.py
Browse files
app.py
CHANGED
|
@@ -170,6 +170,15 @@ def image_properties(img):
|
|
| 170 |
return properties
|
| 171 |
|
| 172 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
def main():
|
| 174 |
# Gradio Interface
|
| 175 |
with gr.Blocks(title="Upscaling Service") as demo:
|
|
@@ -198,12 +207,14 @@ def main():
|
|
| 198 |
with gr.Group():
|
| 199 |
input_image = gr.Image(label="Source Image", type="pil", image_mode="RGBA")
|
| 200 |
input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
|
|
|
|
| 201 |
output_image = gr.Image(label="Restored Image", image_mode="RGBA", show_share_button=False)
|
| 202 |
with gr.Row():
|
| 203 |
restore_btn = gr.Button("Upscale")
|
| 204 |
|
| 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,
|
|
|
|
| 170 |
return properties
|
| 171 |
|
| 172 |
|
| 173 |
+
def image_parameters(img):
|
| 174 |
+
if img:
|
| 175 |
+
try:
|
| 176 |
+
parameters = img.info['parameters']
|
| 177 |
+
except:
|
| 178 |
+
parameters =''
|
| 179 |
+
return parameters
|
| 180 |
+
|
| 181 |
+
|
| 182 |
def main():
|
| 183 |
# Gradio Interface
|
| 184 |
with gr.Blocks(title="Upscaling Service") as demo:
|
|
|
|
| 207 |
with gr.Group():
|
| 208 |
input_image = gr.Image(label="Source Image", type="pil", image_mode="RGBA")
|
| 209 |
input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
|
| 210 |
+
input_image_parameters = gr.TextArea(label="Image Parameters", lines=10)
|
| 211 |
output_image = gr.Image(label="Restored Image", image_mode="RGBA", show_share_button=False)
|
| 212 |
with gr.Row():
|
| 213 |
restore_btn = gr.Button("Upscale")
|
| 214 |
|
| 215 |
# Event listeners:
|
| 216 |
input_image.change(fn=image_properties, inputs=input_image, outputs=input_image_properties)
|
| 217 |
+
input_image.change(fn=image_parameters, inputs=input_image, outputs=input_image_parameters)
|
| 218 |
restore_btn.click(fn=realesrgan,
|
| 219 |
inputs=[input_image, model_name, denoise_strength, face_enhance, outscale, ext],
|
| 220 |
outputs=output_image,
|