Spaces:
Sleeping
Sleeping
feat: Refactor app.py to remove unused code, improve code structure, and add prediction functionality
Browse files
app.py
CHANGED
@@ -27,25 +27,27 @@ with gr.Blocks() as demo:
|
|
27 |
input_image = gr.Image(type="pil", label="Input Image")
|
28 |
run_button = gr.Button("Enhance Image")
|
29 |
with gr.Column():
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
50 |
|
51 |
demo.launch()
|
|
|
27 |
input_image = gr.Image(type="pil", label="Input Image")
|
28 |
run_button = gr.Button("Enhance Image")
|
29 |
with gr.Column():
|
30 |
+
output_image = gr.Image(type="pil", label="Output Image")
|
31 |
+
# output_slider = ImageSlider(label="Before / After", type="numpy")
|
32 |
+
|
33 |
+
with gr.Accordion("Advanced Options", open=False):
|
34 |
+
resolution = gr.Slider(minimum=128, maximum=2048, value=1024, step=128, label="Resolution")
|
35 |
+
num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
|
36 |
+
strength = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label="Strength")
|
37 |
+
hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
|
38 |
+
guidance_scale = gr.Slider(minimum=0, maximum=20, value=6, step=0.5, label="Guidance Scale")
|
39 |
+
controlnet_strength = gr.Slider(minimum=0.0, maximum=2.0, value=0.75, step=0.05, label="ControlNet Strength")
|
40 |
+
scheduler_name = gr.Dropdown(
|
41 |
+
choices=["DDIM", "DPM++ 3M SDE Karras", "DPM++ 3M Karras"],
|
42 |
+
value="DDIM",
|
43 |
+
label="Scheduler"
|
44 |
+
)
|
45 |
+
|
46 |
+
|
47 |
+
run_button.click(
|
48 |
+
fn=gradio_process_image,
|
49 |
+
inputs=[input_image, resolution, num_inference_steps, strength, hdr, guidance_scale, controlnet_strength, scheduler_name],
|
50 |
+
outputs=output_image
|
51 |
+
)
|
52 |
|
53 |
demo.launch()
|