Spaces:
Running
on
Zero
Running
on
Zero
UI enhancements
Browse files- gradio_demo/app.py +16 -19
gradio_demo/app.py
CHANGED
|
@@ -189,15 +189,12 @@ with gr.Blocks() as demo:
|
|
| 189 |
""")
|
| 190 |
with gr.Row():
|
| 191 |
with gr.Column():
|
| 192 |
-
lq_img = gr.Image(label="Low-quality image", type="pil")
|
| 193 |
-
|
| 194 |
-
examples = ["assets/lady.png", "assets/man.png", "assets/dog.png", "assets/panda.png", "assets/sculpture.png", "assets/cottage.png", "assets/Naruto.png", "assets/Konan.png"],
|
| 195 |
-
inputs = [lq_img]
|
| 196 |
-
)
|
| 197 |
-
with gr.Column():
|
| 198 |
with gr.Row():
|
| 199 |
steps = gr.Number(label="Steps", value=30, step=1)
|
| 200 |
cfg_scale = gr.Number(label="CFG Scale", value=7.0, step=0.1)
|
|
|
|
| 201 |
with gr.Row():
|
| 202 |
height = gr.Number(label="Height", value=1024, step=1)
|
| 203 |
weight = gr.Number(label="Weight", value=1024, step=1)
|
|
@@ -207,14 +204,19 @@ with gr.Blocks() as demo:
|
|
| 207 |
preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
|
| 208 |
prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="")
|
| 209 |
mode = gr.Checkbox(label="Creative Restoration", value=False)
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
pipe_out = gr.Gallery(visible=False)
|
| 219 |
clear_btn.add([lq_img, output, preview])
|
| 220 |
restore_btn.click(
|
|
@@ -238,11 +240,6 @@ with gr.Blocks() as demo:
|
|
| 238 |
1. Check the `Creative Restoration` checkbox;
|
| 239 |
2. Input your text prompts in the `Restoration prompts` textbox;
|
| 240 |
3. Set `Start Free Rendering` slider to a medium value (around half of the `steps`) to provide adequate room for InstantIR creation.
|
| 241 |
-
|
| 242 |
-
## Examples
|
| 243 |
-
Here are some examplar usage of InstantIR:
|
| 244 |
-
""")
|
| 245 |
-
# examples = gr.Gallery(label="Examples")
|
| 246 |
|
| 247 |
gr.Markdown(
|
| 248 |
"""
|
|
|
|
| 189 |
""")
|
| 190 |
with gr.Row():
|
| 191 |
with gr.Column():
|
| 192 |
+
lq_img = gr.Image(label="Low-quality image", type="pil")
|
| 193 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
with gr.Row():
|
| 195 |
steps = gr.Number(label="Steps", value=30, step=1)
|
| 196 |
cfg_scale = gr.Number(label="CFG Scale", value=7.0, step=0.1)
|
| 197 |
+
|
| 198 |
with gr.Row():
|
| 199 |
height = gr.Number(label="Height", value=1024, step=1)
|
| 200 |
weight = gr.Number(label="Weight", value=1024, step=1)
|
|
|
|
| 204 |
preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
|
| 205 |
prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="")
|
| 206 |
mode = gr.Checkbox(label="Creative Restoration", value=False)
|
| 207 |
+
|
| 208 |
+
with gr.Row():
|
| 209 |
+
restore_btn = gr.Button("InstantIR magic!")
|
| 210 |
+
clear_btn = gr.ClearButton()
|
| 211 |
+
gr.Examples(
|
| 212 |
+
examples = ["assets/lady.png", "assets/man.png", "assets/dog.png", "assets/panda.png", "assets/sculpture.png", "assets/cottage.png", "assets/Naruto.png", "assets/Konan.png"],
|
| 213 |
+
inputs = [lq_img]
|
| 214 |
+
)
|
| 215 |
+
with gr.Column():
|
| 216 |
+
output = gr.Image(label="InstantIR restored", type="pil")
|
| 217 |
+
index = gr.Slider(label="Restoration Previews", value=29, minimum=0, maximum=29, step=1)
|
| 218 |
+
preview = gr.Image(label="Preview", type="pil")
|
| 219 |
+
|
| 220 |
pipe_out = gr.Gallery(visible=False)
|
| 221 |
clear_btn.add([lq_img, output, preview])
|
| 222 |
restore_btn.click(
|
|
|
|
| 240 |
1. Check the `Creative Restoration` checkbox;
|
| 241 |
2. Input your text prompts in the `Restoration prompts` textbox;
|
| 242 |
3. Set `Start Free Rendering` slider to a medium value (around half of the `steps`) to provide adequate room for InstantIR creation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
gr.Markdown(
|
| 245 |
"""
|