Spaces:
Running
on
Zero
Running
on
Zero
modify layout
Browse files
app.py
CHANGED
@@ -21,12 +21,12 @@ def resize_img(input_image, max_side=1024, min_side=768, width=None, height=None
|
|
21 |
|
22 |
w, h = input_image.size
|
23 |
# Prepare output size
|
24 |
-
if width
|
25 |
out_w, out_h = width, height
|
26 |
-
elif width
|
27 |
out_w = width
|
28 |
out_h = round(h * width / w)
|
29 |
-
elif height
|
30 |
out_h = height
|
31 |
out_w = round(w * height / h)
|
32 |
else:
|
@@ -141,10 +141,6 @@ def show_final_preview(preview_row):
|
|
141 |
def instantir_restore(
|
142 |
lq, prompt="", steps=30, cfg_scale=7.0, guidance_end=1.0,
|
143 |
creative_restoration=False, seed=3407, height=None, width=None, preview_start=0.0):
|
144 |
-
print(type(height), type(width))
|
145 |
-
print(height, width)
|
146 |
-
print(type(prompt))
|
147 |
-
print(prompt)
|
148 |
if creative_restoration:
|
149 |
if "lcm" not in pipe.unet.active_adapters():
|
150 |
pipe.unet.set_adapter('lcm')
|
@@ -224,8 +220,8 @@ with gr.Blocks() as demo:
|
|
224 |
seed = gr.Number(label="Seed", value=42, step=1)
|
225 |
guidance_end = gr.Slider(label="Start Free Rendering", value=30, minimum=0, maximum=30, step=1)
|
226 |
preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
|
227 |
-
prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="")
|
228 |
mode = gr.Checkbox(label="Creative Restoration", value=False)
|
|
|
229 |
# gr.Examples(
|
230 |
# 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"],
|
231 |
# inputs = [lq_img]
|
|
|
21 |
|
22 |
w, h = input_image.size
|
23 |
# Prepare output size
|
24 |
+
if width > 0 and height > 0:
|
25 |
out_w, out_h = width, height
|
26 |
+
elif width > 0:
|
27 |
out_w = width
|
28 |
out_h = round(h * width / w)
|
29 |
+
elif height > 0:
|
30 |
out_h = height
|
31 |
out_w = round(w * height / h)
|
32 |
else:
|
|
|
141 |
def instantir_restore(
|
142 |
lq, prompt="", steps=30, cfg_scale=7.0, guidance_end=1.0,
|
143 |
creative_restoration=False, seed=3407, height=None, width=None, preview_start=0.0):
|
|
|
|
|
|
|
|
|
144 |
if creative_restoration:
|
145 |
if "lcm" not in pipe.unet.active_adapters():
|
146 |
pipe.unet.set_adapter('lcm')
|
|
|
220 |
seed = gr.Number(label="Seed", value=42, step=1)
|
221 |
guidance_end = gr.Slider(label="Start Free Rendering", value=30, minimum=0, maximum=30, step=1)
|
222 |
preview_start = gr.Slider(label="Preview Start", value=0, minimum=0, maximum=30, step=1)
|
|
|
223 |
mode = gr.Checkbox(label="Creative Restoration", value=False)
|
224 |
+
prompt = gr.Textbox(label="Restoration prompts (Optional)", placeholder="")
|
225 |
# gr.Examples(
|
226 |
# 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"],
|
227 |
# inputs = [lq_img]
|