Spaces:
Paused
Paused
Commit
·
65857b1
1
Parent(s):
63b37a8
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,15 +171,10 @@ def image_properties(img):
|
|
| 171 |
|
| 172 |
def main():
|
| 173 |
# Gradio Interface
|
| 174 |
-
with gr.Blocks(title="
|
| 175 |
|
| 176 |
gr.Markdown(
|
| 177 |
-
"""
|
| 178 |
-
<div align="center"><img width="200" height="74" src="https://github.com/xinntao/Real-ESRGAN/raw/master/assets/realesrgan_logo.png"></div>
|
| 179 |
-
|
| 180 |
-
This Gradio Demo was built as my Final Project for **CS50's Introduction to Programming with Python**.
|
| 181 |
-
Please visit the [Real-ESRGAN GitHub page](https://github.com/xinntao/Real-ESRGAN) for detailed information about the project.
|
| 182 |
-
"""
|
| 183 |
)
|
| 184 |
|
| 185 |
with gr.Accordion("Options/Parameters"):
|
|
@@ -191,7 +186,7 @@ def main():
|
|
| 191 |
denoise_strength = gr.Slider(label="Denoise Strength (Used only with the realesr-general-x4v3 model)",
|
| 192 |
minimum=0, maximum=1, step=0.1, value=0.5)
|
| 193 |
outscale = gr.Slider(label="Image Upscaling Factor",
|
| 194 |
-
minimum=1, maximum=10, step=1, value=
|
| 195 |
face_enhance = gr.Checkbox(label="Face Enhancement using GFPGAN (Doesn't work for anime images)",
|
| 196 |
value=False, show_label=True)
|
| 197 |
|
|
@@ -201,8 +196,7 @@ def main():
|
|
| 201 |
input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
|
| 202 |
output_image = gr.Image(label="Restored Image", image_mode="RGBA")
|
| 203 |
with gr.Row():
|
| 204 |
-
restore_btn = gr.Button("
|
| 205 |
-
reset_btn = gr.Button("Reset")
|
| 206 |
|
| 207 |
# Event listeners:
|
| 208 |
input_image.change(fn=image_properties, inputs=input_image, outputs=input_image_properties)
|
|
@@ -210,9 +204,6 @@ def main():
|
|
| 210 |
inputs=[input_image, model_name, denoise_strength, face_enhance, outscale],
|
| 211 |
outputs=output_image,
|
| 212 |
api_name="upscale")
|
| 213 |
-
reset_btn.click(fn=reset, inputs=[], outputs=[output_image, input_image])
|
| 214 |
-
# reset_btn.click(None, inputs=[], outputs=[input_image], _js="() => (null)\n")
|
| 215 |
-
# Undocumented method to clear a component's value using Javascript
|
| 216 |
|
| 217 |
gr.Markdown(
|
| 218 |
"""*Please note that support for animated GIFs is not yet implemented. Should an animated GIF is chosen for restoration,
|
|
|
|
| 171 |
|
| 172 |
def main():
|
| 173 |
# Gradio Interface
|
| 174 |
+
with gr.Blocks(title="Upscaling Service", theme="dark") as demo:
|
| 175 |
|
| 176 |
gr.Markdown(
|
| 177 |
+
"""This Space is a fork of "Real-ESRGAN-Demo", so if you want to use it please refer to [havas79/Real-ESRGAN_Demo](https://huggingface.co/spaces/havas79/Real-ESRGAN_Demo), thank you!"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
)
|
| 179 |
|
| 180 |
with gr.Accordion("Options/Parameters"):
|
|
|
|
| 186 |
denoise_strength = gr.Slider(label="Denoise Strength (Used only with the realesr-general-x4v3 model)",
|
| 187 |
minimum=0, maximum=1, step=0.1, value=0.5)
|
| 188 |
outscale = gr.Slider(label="Image Upscaling Factor",
|
| 189 |
+
minimum=1, maximum=10, step=1, value=3, show_label=True)
|
| 190 |
face_enhance = gr.Checkbox(label="Face Enhancement using GFPGAN (Doesn't work for anime images)",
|
| 191 |
value=False, show_label=True)
|
| 192 |
|
|
|
|
| 196 |
input_image_properties = gr.Textbox(label="Image Properties", max_lines=1)
|
| 197 |
output_image = gr.Image(label="Restored Image", image_mode="RGBA")
|
| 198 |
with gr.Row():
|
| 199 |
+
restore_btn = gr.Button("Upscale")
|
|
|
|
| 200 |
|
| 201 |
# Event listeners:
|
| 202 |
input_image.change(fn=image_properties, inputs=input_image, outputs=input_image_properties)
|
|
|
|
| 204 |
inputs=[input_image, model_name, denoise_strength, face_enhance, outscale],
|
| 205 |
outputs=output_image,
|
| 206 |
api_name="upscale")
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
gr.Markdown(
|
| 209 |
"""*Please note that support for animated GIFs is not yet implemented. Should an animated GIF is chosen for restoration,
|