Spaces:
Running
on
Zero
Running
on
Zero
NightRaven109
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -191,13 +191,15 @@ DEFAULT_VALUES = {
|
|
191 |
"color_fix_method": "adain"
|
192 |
}
|
193 |
|
194 |
-
def process_example(
|
195 |
-
#
|
196 |
-
|
|
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
input_img, # input_image
|
201 |
prompt_text,
|
202 |
neg_prompt,
|
203 |
guid_scale,
|
@@ -206,19 +208,10 @@ def process_example(example_data):
|
|
206 |
seed_val,
|
207 |
up_factor,
|
208 |
color_method,
|
209 |
-
|
210 |
-
|
211 |
]
|
212 |
-
|
213 |
-
# Then process the image
|
214 |
-
output = process_image(
|
215 |
-
input_img, prompt_text, neg_prompt, guid_scale,
|
216 |
-
cond_scale, steps, seed_val, up_factor, color_method
|
217 |
-
)
|
218 |
-
|
219 |
-
return results[:-2] + [input_img, output] # Return all updated values plus input/output images
|
220 |
|
221 |
-
# Create interface components
|
222 |
with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
|
223 |
gr.Markdown("## Controllable Conditional Super-Resolution")
|
224 |
gr.Markdown("Upload an image to enhance its resolution using CCSR.")
|
@@ -309,18 +302,21 @@ with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
|
|
309 |
]
|
310 |
|
311 |
# Add gallery of examples
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
|
|
|
|
|
|
324 |
|
325 |
# Define submit action
|
326 |
submit_btn.click(
|
@@ -370,4 +366,5 @@ with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
|
|
370 |
)
|
371 |
|
372 |
if __name__ == "__main__":
|
373 |
-
demo.launch()
|
|
|
|
191 |
"color_fix_method": "adain"
|
192 |
}
|
193 |
|
194 |
+
def process_example(img_path, prompt_text, neg_prompt, guid_scale, cond_scale, steps, seed_val, up_factor, color_method):
|
195 |
+
# Update UI components and process image
|
196 |
+
output = process_image(
|
197 |
+
img_path, prompt_text, neg_prompt, guid_scale,
|
198 |
+
cond_scale, steps, seed_val, up_factor, color_method
|
199 |
+
)
|
200 |
|
201 |
+
return [
|
202 |
+
img_path, # input_image
|
|
|
203 |
prompt_text,
|
204 |
neg_prompt,
|
205 |
guid_scale,
|
|
|
208 |
seed_val,
|
209 |
up_factor,
|
210 |
color_method,
|
211 |
+
img_path, # preview_input
|
212 |
+
output # output_image
|
213 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
|
|
|
215 |
with gr.Blocks(title="Controllable Conditional Super-Resolution") as demo:
|
216 |
gr.Markdown("## Controllable Conditional Super-Resolution")
|
217 |
gr.Markdown("Upload an image to enhance its resolution using CCSR.")
|
|
|
302 |
]
|
303 |
|
304 |
# Add gallery of examples
|
305 |
+
gr.Examples(
|
306 |
+
examples=examples,
|
307 |
+
inputs=[
|
308 |
+
input_image, prompt, negative_prompt, guidance_scale,
|
309 |
+
conditioning_scale, num_steps, seed, upscale_factor,
|
310 |
+
color_fix_method
|
311 |
+
],
|
312 |
+
outputs=[
|
313 |
+
input_image, prompt, negative_prompt, guidance_scale,
|
314 |
+
conditioning_scale, num_steps, seed, upscale_factor,
|
315 |
+
color_fix_method, preview_input, output_image
|
316 |
+
],
|
317 |
+
fn=process_example,
|
318 |
+
cache_examples=True,
|
319 |
+
)
|
320 |
|
321 |
# Define submit action
|
322 |
submit_btn.click(
|
|
|
366 |
)
|
367 |
|
368 |
if __name__ == "__main__":
|
369 |
+
demo.launch()
|
370 |
+
|