Spaces:
Configuration error
Configuration error
liuyizhang
commited on
Commit
•
e7ef33d
1
Parent(s):
9dccae8
update app.py
Browse files
app.py
CHANGED
@@ -237,7 +237,7 @@ groundingdino_model = load_model_hf(config_file, ckpt_repo_id, ckpt_filenmae)
|
|
237 |
|
238 |
# initialize SAM
|
239 |
logger.info(f"initialize SAM model...")
|
240 |
-
sam_model = build_sam(checkpoint=sam_checkpoint).to(device)
|
241 |
sam_predictor = SamPredictor(sam_model)
|
242 |
sam_mask_generator = SamAutomaticMaskGenerator(sam_model)
|
243 |
|
@@ -726,16 +726,18 @@ if __name__ == "__main__":
|
|
726 |
with gr.Column():
|
727 |
# gsa_gallery = gr.Gallery(
|
728 |
# label="result images", show_label=True, elem_id="gsa_gallery"
|
729 |
-
#
|
730 |
-
gallery = gr.Gallery(label="
|
731 |
-
|
732 |
|
733 |
run_button.click(fn=run_anything_task, inputs=[
|
734 |
input_image, text_prompt, task_type, inpaint_prompt, box_threshold, text_threshold, iou_threshold, inpaint_mode, mask_source_radio, remove_mode, remove_mask_extend, num_relation], outputs=[gallery, gallery])
|
735 |
task_type.change(fn=change_radio_display, inputs=[task_type, mask_source_radio], outputs=[text_prompt, inpaint_prompt, mask_source_radio, num_relation])
|
736 |
mask_source_radio.change(fn=change_radio_display, inputs=[task_type, mask_source_radio], outputs=[text_prompt, inpaint_prompt, mask_source_radio, num_relation])
|
737 |
|
738 |
-
DESCRIPTION = '### This demo from [Grounded-Segment-Anything](https://github.com/IDEA-Research/Grounded-Segment-Anything).
|
|
|
|
|
739 |
DESCRIPTION += f'<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/yizhangliu/Grounded-Segment-Anything?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'
|
740 |
gr.Markdown(DESCRIPTION)
|
741 |
|
|
|
237 |
|
238 |
# initialize SAM
|
239 |
logger.info(f"initialize SAM model...")
|
240 |
+
sam_model = build_sam(checkpoint=sam_checkpoint) # .to(device)
|
241 |
sam_predictor = SamPredictor(sam_model)
|
242 |
sam_mask_generator = SamAutomaticMaskGenerator(sam_model)
|
243 |
|
|
|
726 |
with gr.Column():
|
727 |
# gsa_gallery = gr.Gallery(
|
728 |
# label="result images", show_label=True, elem_id="gsa_gallery"
|
729 |
+
# ).style(grid=[2], full_width=True, full_height=True)
|
730 |
+
gallery = gr.Gallery(label="result images", show_label=True, elem_id="gallery")
|
731 |
+
.style(preview=True, columns=5, object_fit="scale-down", full_width=True, full_height=True)
|
732 |
|
733 |
run_button.click(fn=run_anything_task, inputs=[
|
734 |
input_image, text_prompt, task_type, inpaint_prompt, box_threshold, text_threshold, iou_threshold, inpaint_mode, mask_source_radio, remove_mode, remove_mask_extend, num_relation], outputs=[gallery, gallery])
|
735 |
task_type.change(fn=change_radio_display, inputs=[task_type, mask_source_radio], outputs=[text_prompt, inpaint_prompt, mask_source_radio, num_relation])
|
736 |
mask_source_radio.change(fn=change_radio_display, inputs=[task_type, mask_source_radio], outputs=[text_prompt, inpaint_prompt, mask_source_radio, num_relation])
|
737 |
|
738 |
+
DESCRIPTION = '### This demo from [Grounded-Segment-Anything](https://github.com/IDEA-Research/Grounded-Segment-Anything). <br>'
|
739 |
+
DESCRIPTION += '### RAM from [RelateAnything](https://github.com/Luodian/RelateAnything). <br>'
|
740 |
+
DESCRIPTION += '### Thanks for their excellent work.'
|
741 |
DESCRIPTION += f'<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/yizhangliu/Grounded-Segment-Anything?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'
|
742 |
gr.Markdown(DESCRIPTION)
|
743 |
|