sacj AdityA36912355 commited on
Commit
0596d11
1 Parent(s): 8512b06

Update app.py (#5)

Browse files

- Update app.py (83a45d3c63be98c9a3088f2921b1e63194f1934f)


Co-authored-by: Aditya Deshmukh <[email protected]>

Files changed (1) hide show
  1. app.py +18 -17
app.py CHANGED
@@ -261,31 +261,32 @@ def custom_infer(input_image_path,
261
  a, b = predict(input_dict, prompt, fitting_degree, ddim_steps, scale, seed, negative_prompt, task, left_expansion_ratio, right_expansion_ratio, top_expansion_ratio, bottom_expansion_ratio)
262
 
263
  return a, b
 
264
 
265
- # Create the Gradio interface
266
  inputs = [
267
- gr.inputs.Image(label="Input Image", type="filepath"),
268
- gr.inputs.Image(label="Input Mask (optional)", type="filepath"),
269
- gr.inputs.Textbox(label="Prompt", default="A beautiful landscape"),
270
- gr.inputs.Slider(label="Fitting Degree", minimum=1, maximum=20, value=7, step=1),
271
- gr.inputs.Slider(label="DDIM Steps", minimum=10, maximum=100, value=20, step=1),
272
- gr.inputs.Slider(label="Scale", minimum=1, maximum=20, value=7.5, step=0.1),
273
- gr.inputs.Slider(label="Use Seed", minimum=0, maximum=1300000,value=143,step=1),
274
- gr.inputs.Textbox(label="Negative Prompt", default="blur, low quality"),
275
- gr.inputs.Radio(label="Task", choices=["text-guided", "image-outpainting"], value="image-outpainting"),
276
- gr.inputs.Slider(label="Left Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
277
- gr.inputs.Slider(label="Right Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
278
- gr.inputs.Slider(label="Top Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
279
- gr.inputs.Slider(label="Bottom Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01)
280
  ]
281
 
282
  outputs = [
283
- gr.outputs.Image(label="Output Image"),
284
- gr.outputs.Textbox(label="Output Text")
285
  ]
286
 
287
  # Create the Gradio interface
288
- demo = gr.Interface(fn=custom_infer, inputs=inputs, outputs=outputs, title="Custom Infer")
289
 
290
  demo.queue(concurrency_count=1, max_size=1, api_open=True)
291
  demo.launch(show_api=True)
 
261
  a, b = predict(input_dict, prompt, fitting_degree, ddim_steps, scale, seed, negative_prompt, task, left_expansion_ratio, right_expansion_ratio, top_expansion_ratio, bottom_expansion_ratio)
262
 
263
  return a, b
264
+ import gradio as gr
265
 
266
+ # Define the Gradio interface using the new version
267
  inputs = [
268
+ gr.Image(label="Input Image", type="filepath"),
269
+ gr.Image(label="Input Mask (optional)", type="filepath"),
270
+ gr.Textbox(label="Prompt", value="A beautiful landscape"),
271
+ gr.Slider(label="Fitting Degree", minimum=1, maximum=20, value=7, step=1),
272
+ gr.Slider(label="DDIM Steps", minimum=10, maximum=100, value=20, step=1),
273
+ gr.Slider(label="Scale", minimum=1, maximum=20, value=7.5, step=0.1),
274
+ gr.Slider(label="Use Seed", minimum=0, maximum=1300000, value=143, step=1),
275
+ gr.Textbox(label="Negative Prompt", value="blur, low quality"),
276
+ gr.Radio(label="Task", choices=["text-guided", "image-outpainting"], value="image-outpainting"),
277
+ gr.Slider(label="Left Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
278
+ gr.Slider(label="Right Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
279
+ gr.Slider(label="Top Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01),
280
+ gr.Slider(label="Bottom Expansion Ratio", minimum=0, maximum=2, value=0.2, step=0.01)
281
  ]
282
 
283
  outputs = [
284
+ gr.Image(label="Output Image"),
285
+ gr.Textbox(label="Output Text")
286
  ]
287
 
288
  # Create the Gradio interface
289
+ demo = gr.Interface(fn=custom_infer, inputs=inputs, outputs=outputs, title="Inference")
290
 
291
  demo.queue(concurrency_count=1, max_size=1, api_open=True)
292
  demo.launch(show_api=True)