Lisandro commited on
Commit
2ad8279
1 Parent(s): 36527bc

feat: Refactor app.py to remove unused code, improve code structure, and add prediction functionality

Browse files
Files changed (1) hide show
  1. app.py +22 -20
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
- output_slider = ImageSlider(label="Before / After", type="numpy")
31
- with gr.Accordion("Advanced Options", open=False):
32
- resolution = gr.Slider(minimum=128, maximum=2048, value=1024, step=128, label="Resolution")
33
- num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
34
- strength = gr.Slider(minimum=0, maximum=1, value=0.2, step=0.01, label="Strength")
35
- hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
36
- guidance_scale = gr.Slider(minimum=0, maximum=20, value=6, step=0.5, label="Guidance Scale")
37
- controlnet_strength = gr.Slider(minimum=0.0, maximum=2.0, value=0.75, step=0.05, label="ControlNet Strength")
38
- scheduler_name = gr.Dropdown(
39
- choices=["DDIM", "DPM++ 3M SDE Karras", "DPM++ 3M Karras"],
40
- value="DDIM",
41
- label="Scheduler"
42
- )
43
-
44
-
45
- # run_button.click(
46
- # fn=gradio_process_image,
47
- # inputs=[input_image, resolution, num_inference_steps, strength, hdr, guidance_scale, controlnet_strength, scheduler_name],
48
- # outputs=output_slider
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()