Spaces:
Runtime error
Runtime error
Update app.py
Browse filesFix Indentation RunTimeError
app.py
CHANGED
|
@@ -304,34 +304,34 @@ if __name__ == "__main__":
|
|
| 304 |
|
| 305 |
|
| 306 |
with block:
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
|
| 337 |
block.launch(debug=args.debug, share=args.share, show_error=True)
|
|
|
|
| 304 |
|
| 305 |
|
| 306 |
with block:
|
| 307 |
+
with gr.Row():
|
| 308 |
+
with gr.Column():
|
| 309 |
+
input_image = gr.Image(
|
| 310 |
+
source='upload', type="pil", value="demo1.jpg")
|
| 311 |
+
task_type = gr.Dropdown(
|
| 312 |
+
["det", "seg", "inpainting", "automatic"], value="seg", label="task_type")
|
| 313 |
+
text_prompt = gr.Textbox(label="Text Prompt", placeholder="bear . beach .")
|
| 314 |
+
inpaint_prompt = gr.Textbox(label="Inpaint Prompt", placeholder="A dinosaur, detailed, 4K.")
|
| 315 |
+
run_button = gr.Button(label="Run")
|
| 316 |
+
with gr.Accordion("Advanced options", open=False):
|
| 317 |
+
box_threshold = gr.Slider(
|
| 318 |
+
label="Box Threshold", minimum=0.0, maximum=1.0, value=0.3, step=0.001
|
| 319 |
+
)
|
| 320 |
+
text_threshold = gr.Slider(
|
| 321 |
+
label="Text Threshold", minimum=0.0, maximum=1.0, value=0.25, step=0.001
|
| 322 |
+
)
|
| 323 |
+
iou_threshold = gr.Slider(
|
| 324 |
+
label="IOU Threshold", minimum=0.0, maximum=1.0, value=0.8, step=0.001
|
| 325 |
+
)
|
| 326 |
+
inpaint_mode = gr.Dropdown(
|
| 327 |
+
["merge", "first"], value="merge", label="inpaint_mode")
|
| 328 |
+
|
| 329 |
+
with gr.Column():
|
| 330 |
+
gallery = gr.Gallery(
|
| 331 |
+
label="Generated images", show_label=False, elem_id="gallery"
|
| 332 |
+
).style(preview=True, grid=2, object_fit="scale-down")
|
| 333 |
+
|
| 334 |
+
run_button.click(fn=run_grounded_sam, inputs=[
|
| 335 |
+
input_image, text_prompt, task_type, inpaint_prompt, box_threshold, text_threshold, iou_threshold, inpaint_mode], outputs=gallery)
|
| 336 |
|
| 337 |
block.launch(debug=args.debug, share=args.share, show_error=True)
|