Spaces:
Paused
Paused
Update app.py (#5)
Browse files- Update app.py (83a45d3c63be98c9a3088f2921b1e63194f1934f)
Co-authored-by: Aditya Deshmukh <[email protected]>
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 |
-
#
|
| 266 |
inputs = [
|
| 267 |
-
gr.
|
| 268 |
-
gr.
|
| 269 |
-
gr.
|
| 270 |
-
gr.
|
| 271 |
-
gr.
|
| 272 |
-
gr.
|
| 273 |
-
gr.
|
| 274 |
-
gr.
|
| 275 |
-
gr.
|
| 276 |
-
gr.
|
| 277 |
-
gr.
|
| 278 |
-
gr.
|
| 279 |
-
gr.
|
| 280 |
]
|
| 281 |
|
| 282 |
outputs = [
|
| 283 |
-
gr.
|
| 284 |
-
gr.
|
| 285 |
]
|
| 286 |
|
| 287 |
# Create the Gradio interface
|
| 288 |
-
demo = gr.Interface(fn=custom_infer, inputs=inputs, outputs=outputs, title="
|
| 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)
|