Spaces:
Paused
Paused
Commit
·
8846a66
1
Parent(s):
b44a93c
Update app.py
Browse files
app.py
CHANGED
|
@@ -551,7 +551,7 @@ def run_anything_task(input_image, text_prompt, box_threshold, text_threshold,
|
|
| 551 |
assert sam_checkpoint, 'sam_checkpoint is not found!'
|
| 552 |
# draw output image
|
| 553 |
plt.figure(figsize=(10, 10))
|
| 554 |
-
plt.imshow(image)
|
| 555 |
for mask in masks:
|
| 556 |
show_mask(mask.cpu().numpy(), plt.gca(), random_color=True)
|
| 557 |
for box, label in zip(boxes_filt, pred_phrases):
|
|
@@ -563,14 +563,8 @@ def run_anything_task(input_image, text_prompt, box_threshold, text_threshold,
|
|
| 563 |
os.remove(image_path)
|
| 564 |
output_images.append(segment_image_result)
|
| 565 |
|
| 566 |
-
logger.info(f'run_anything_task_[{file_temp}]_{task_type}
|
| 567 |
-
|
| 568 |
-
logger.info(f'run_anything_task_[{file_temp}]_{task_type}_9_')
|
| 569 |
-
return output_images, gr.Gallery.update(label='result images')
|
| 570 |
-
else:
|
| 571 |
-
logger.info(f"task_type:{task_type} error!")
|
| 572 |
-
logger.info(f'run_anything_task_[{file_temp}]_9_9_')
|
| 573 |
-
return output_images, gr.Gallery.update(label='result images')
|
| 574 |
|
| 575 |
if __name__ == "__main__":
|
| 576 |
parser = argparse.ArgumentParser("Grounded SAM demo", add_help=True)
|
|
@@ -613,7 +607,7 @@ if __name__ == "__main__":
|
|
| 613 |
).style(preview=True, columns=[5], object_fit="scale-down", height="auto")
|
| 614 |
|
| 615 |
run_button.click(fn=run_anything_task, inputs=[
|
| 616 |
-
input_image, text_prompt, box_threshold, text_threshold, iou_threshold], outputs=[image_gallery, image_gallery], show_progress=True, queue=True)
|
| 617 |
|
| 618 |
|
| 619 |
computer_info()
|
|
|
|
| 551 |
assert sam_checkpoint, 'sam_checkpoint is not found!'
|
| 552 |
# draw output image
|
| 553 |
plt.figure(figsize=(10, 10))
|
| 554 |
+
# plt.imshow(image)
|
| 555 |
for mask in masks:
|
| 556 |
show_mask(mask.cpu().numpy(), plt.gca(), random_color=True)
|
| 557 |
for box, label in zip(boxes_filt, pred_phrases):
|
|
|
|
| 563 |
os.remove(image_path)
|
| 564 |
output_images.append(segment_image_result)
|
| 565 |
|
| 566 |
+
logger.info(f'run_anything_task_[{file_temp}]_{task_type}_9_')
|
| 567 |
+
return output_images, gr.Gallery.update(label='result images')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 568 |
|
| 569 |
if __name__ == "__main__":
|
| 570 |
parser = argparse.ArgumentParser("Grounded SAM demo", add_help=True)
|
|
|
|
| 607 |
).style(preview=True, columns=[5], object_fit="scale-down", height="auto")
|
| 608 |
|
| 609 |
run_button.click(fn=run_anything_task, inputs=[
|
| 610 |
+
input_image, text_prompt, box_threshold, text_threshold, iou_threshold], outputs=[gr.JSON(), image_gallery, image_gallery], show_progress=True, queue=True)
|
| 611 |
|
| 612 |
|
| 613 |
computer_info()
|