Spaces:
Runtime error
Runtime error
Tobias Cornille
commited on
Commit
·
77202d8
1
Parent(s):
05b6776
Use new AnnotatedImage component
Browse files
app.py
CHANGED
|
@@ -347,10 +347,15 @@ def generate_panoptic_mask(
|
|
| 347 |
panoptic_inds[thing_mask.squeeze()] = ind
|
| 348 |
ind += 1
|
| 349 |
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
|
| 355 |
|
| 356 |
config_file = "GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py"
|
|
@@ -450,7 +455,7 @@ if __name__ == "__main__":
|
|
| 450 |
)
|
| 451 |
|
| 452 |
with gr.Column():
|
| 453 |
-
|
| 454 |
|
| 455 |
examples = gr.Examples(
|
| 456 |
examples=[
|
|
@@ -502,7 +507,7 @@ if __name__ == "__main__":
|
|
| 502 |
shrink_kernel_size,
|
| 503 |
num_samples_factor,
|
| 504 |
],
|
| 505 |
-
outputs=[
|
| 506 |
)
|
| 507 |
|
| 508 |
block.launch(server_name="0.0.0.0", debug=args.debug, share=args.share)
|
|
|
|
| 347 |
panoptic_inds[thing_mask.squeeze()] = ind
|
| 348 |
ind += 1
|
| 349 |
|
| 350 |
+
panoptic_bool_masks = (
|
| 351 |
+
semantic_inds_to_shrunken_bool_masks(panoptic_inds, 0, ind + 1)
|
| 352 |
+
.numpy()
|
| 353 |
+
.astype(int)
|
| 354 |
+
)
|
| 355 |
+
category_names = ["background"] + stuff_category_names + thing_category_names
|
| 356 |
+
subsection_label_pairs = zip(panoptic_bool_masks, category_names)
|
| 357 |
+
|
| 358 |
+
return (image_array, subsection_label_pairs)
|
| 359 |
|
| 360 |
|
| 361 |
config_file = "GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py"
|
|
|
|
| 455 |
)
|
| 456 |
|
| 457 |
with gr.Column():
|
| 458 |
+
annotated_image = gr.AnnotatedImage()
|
| 459 |
|
| 460 |
examples = gr.Examples(
|
| 461 |
examples=[
|
|
|
|
| 507 |
shrink_kernel_size,
|
| 508 |
num_samples_factor,
|
| 509 |
],
|
| 510 |
+
outputs=[annotated_image],
|
| 511 |
)
|
| 512 |
|
| 513 |
block.launch(server_name="0.0.0.0", debug=args.debug, share=args.share)
|