SlouchyBuffalo commited on
Commit
c8c1ad2
·
verified ·
1 Parent(s): 24431a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -33
app.py CHANGED
@@ -201,36 +201,17 @@ title = """<h1 align="center">Image Upscaler with Tile Controlnet</h1>
201
  </center></p>
202
  """
203
 
204
- with gr.Blocks() as demo:
205
- gr.HTML(title)
206
- with gr.Row():
207
- with gr.Column():
208
- input_image = gr.Image(type="pil", label="Input Image")
209
- run_button = gr.Button("Enhance Image")
210
- with gr.Column():
211
- output_slider = ImageSlider(label="Before / After", type="numpy")
212
- with gr.Accordion("Advanced Options", open=False):
213
- resolution = gr.Slider(minimum=256, maximum=2048, value=512, step=256, label="Resolution")
214
- num_inference_steps = gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps")
215
- strength = gr.Slider(minimum=0, maximum=1, value=0.4, step=0.01, label="Strength")
216
- hdr = gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect")
217
- guidance_scale = gr.Slider(minimum=0, maximum=20, value=3, step=0.5, label="Guidance Scale")
218
-
219
- run_button.click(fn=gradio_process_image,
220
- inputs=[input_image, resolution, num_inference_steps, strength, hdr, guidance_scale],
221
- outputs=output_slider)
222
-
223
- # Add examples with all required inputs
224
- gr.Examples(
225
- examples=[
226
- ["image1.jpg", 512, 20, 0.4, 0, 3],
227
- ["image2.png", 512, 20, 0.4, 0, 3],
228
- ["image3.png", 512, 20, 0.4, 0, 3],
229
- ],
230
- inputs=[input_image, resolution, num_inference_steps, strength, hdr, guidance_scale],
231
- outputs=output_slider,
232
- fn=gradio_process_image,
233
- cache_examples=True,
234
- )
235
-
236
- demo.launch(share=True)
 
201
  </center></p>
202
  """
203
 
204
+ demo = gr.Interface(
205
+ fn=gradio_process_image,
206
+ inputs=[
207
+ gr.Image(type="pil", label="Input Image"),
208
+ gr.Slider(minimum=256, maximum=2048, value=512, step=256, label="Resolution"),
209
+ gr.Slider(minimum=1, maximum=50, value=20, step=1, label="Number of Inference Steps"),
210
+ gr.Slider(minimum=0, maximum=1, value=0.4, step=0.01, label="Strength"),
211
+ gr.Slider(minimum=0, maximum=1, value=0, step=0.1, label="HDR Effect"),
212
+ gr.Slider(minimum=0, maximum=20, value=3, step=0.5, label="Guidance Scale")
213
+ ],
214
+ outputs=ImageSlider(label="Before / After", type="numpy"),
215
+ title="Image Upscaler with Tile Controlnet"
216
+ )
217
+ demo.launch()