Spaces:
Runtime error
Runtime error
Tobias Cornille
commited on
Commit
·
7c85c0b
1
Parent(s):
549f527
Fix lay-out
Browse files
app.py
CHANGED
|
@@ -393,63 +393,64 @@ if __name__ == "__main__":
|
|
| 393 |
|
| 394 |
block = gr.Blocks(title="Panoptic Segment Anything").queue()
|
| 395 |
with block:
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
with gr.
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
stuff_category_names_string = gr.Textbox(
|
| 410 |
-
label="Stuff categories (i.e. categories without instances), comma-separated",
|
| 411 |
-
placeholder="E.g. sky, road, buildings",
|
| 412 |
-
)
|
| 413 |
-
run_button = gr.Button(label="Run")
|
| 414 |
-
with gr.Accordion("Advanced options", open=False):
|
| 415 |
-
box_threshold = gr.Slider(
|
| 416 |
-
label="Grounding DINO box threshold",
|
| 417 |
-
minimum=0.0,
|
| 418 |
-
maximum=1.0,
|
| 419 |
-
value=0.3,
|
| 420 |
-
step=0.001,
|
| 421 |
-
)
|
| 422 |
-
text_threshold = gr.Slider(
|
| 423 |
-
label="Grounding DINO text threshold",
|
| 424 |
-
minimum=0.0,
|
| 425 |
-
maximum=1.0,
|
| 426 |
-
value=0.25,
|
| 427 |
-
step=0.001,
|
| 428 |
-
)
|
| 429 |
-
segmentation_background_threshold = gr.Slider(
|
| 430 |
-
label="Segmentation background threshold (under this threshold, a pixel is considered background)",
|
| 431 |
-
minimum=0.0,
|
| 432 |
-
maximum=1.0,
|
| 433 |
-
value=0.1,
|
| 434 |
-
step=0.001,
|
| 435 |
-
)
|
| 436 |
-
shrink_kernel_size = gr.Slider(
|
| 437 |
-
label="Shrink kernel size (how much to shrink the mask before sampling points)",
|
| 438 |
-
minimum=0,
|
| 439 |
-
maximum=100,
|
| 440 |
-
value=20,
|
| 441 |
-
step=1,
|
| 442 |
)
|
| 443 |
-
|
| 444 |
-
label="
|
| 445 |
-
|
| 446 |
-
maximum=1000,
|
| 447 |
-
value=1000,
|
| 448 |
-
step=1,
|
| 449 |
)
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
examples = gr.Examples(
|
| 455 |
examples=[
|
|
|
|
| 393 |
|
| 394 |
block = gr.Blocks(title="Panoptic Segment Anything").queue()
|
| 395 |
with block:
|
| 396 |
+
with gr.Column():
|
| 397 |
+
title = gr.Markdown(
|
| 398 |
+
"# [Panoptic Segment Anything](https://github.com/segments-ai/panoptic-segment-anything)"
|
| 399 |
+
)
|
| 400 |
+
description = gr.Markdown(
|
| 401 |
+
"Demo for zero-shot panoptic segmentation using Segment Anything, Grounding DINO, and CLIPSeg."
|
| 402 |
+
)
|
| 403 |
+
with gr.Row():
|
| 404 |
+
with gr.Column():
|
| 405 |
+
input_image = gr.Image(source="upload", type="pil")
|
| 406 |
+
thing_category_names_string = gr.Textbox(
|
| 407 |
+
label="Thing categories (i.e. categories with instances), comma-separated",
|
| 408 |
+
placeholder="E.g. car, bus, person",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 409 |
)
|
| 410 |
+
stuff_category_names_string = gr.Textbox(
|
| 411 |
+
label="Stuff categories (i.e. categories without instances), comma-separated",
|
| 412 |
+
placeholder="E.g. sky, road, buildings",
|
|
|
|
|
|
|
|
|
|
| 413 |
)
|
| 414 |
+
run_button = gr.Button(label="Run")
|
| 415 |
+
with gr.Accordion("Advanced options", open=False):
|
| 416 |
+
box_threshold = gr.Slider(
|
| 417 |
+
label="Grounding DINO box threshold",
|
| 418 |
+
minimum=0.0,
|
| 419 |
+
maximum=1.0,
|
| 420 |
+
value=0.3,
|
| 421 |
+
step=0.001,
|
| 422 |
+
)
|
| 423 |
+
text_threshold = gr.Slider(
|
| 424 |
+
label="Grounding DINO text threshold",
|
| 425 |
+
minimum=0.0,
|
| 426 |
+
maximum=1.0,
|
| 427 |
+
value=0.25,
|
| 428 |
+
step=0.001,
|
| 429 |
+
)
|
| 430 |
+
segmentation_background_threshold = gr.Slider(
|
| 431 |
+
label="Segmentation background threshold (under this threshold, a pixel is considered background)",
|
| 432 |
+
minimum=0.0,
|
| 433 |
+
maximum=1.0,
|
| 434 |
+
value=0.1,
|
| 435 |
+
step=0.001,
|
| 436 |
+
)
|
| 437 |
+
shrink_kernel_size = gr.Slider(
|
| 438 |
+
label="Shrink kernel size (how much to shrink the mask before sampling points)",
|
| 439 |
+
minimum=0,
|
| 440 |
+
maximum=100,
|
| 441 |
+
value=20,
|
| 442 |
+
step=1,
|
| 443 |
+
)
|
| 444 |
+
num_samples_factor = gr.Slider(
|
| 445 |
+
label="Number of samples factor (how many points to sample in the largest category)",
|
| 446 |
+
minimum=0,
|
| 447 |
+
maximum=1000,
|
| 448 |
+
value=1000,
|
| 449 |
+
step=1,
|
| 450 |
+
)
|
| 451 |
+
|
| 452 |
+
with gr.Column():
|
| 453 |
+
plot = gr.Plot()
|
| 454 |
|
| 455 |
examples = gr.Examples(
|
| 456 |
examples=[
|