import gradio as gr from demo import query_image description = """ Github link: Link Gradio demo for combining Segment-Anything (SAM) OWL-ViT. \n\nYou can use OWL-ViT to query boxes with text descriptions of any object, then SAM will segment anything in the boxes. Note: In this demo, I only get the one box per class to demonstrate, you can modify the code to get multiple boxes beyond a threshold. """ demo = gr.Interface( query_image, inputs=[gr.Image(), "text"], outputs=["image", "image"], title="Segment Anything (SAM) with OWL-ViT", description=description, examples=[ ["./demo_images/cats.png", "cats,ears"], ["./demo_images/demo1.jpg", "bear,soil,sea"], ["./demo_images/demo2.jpg", "dog,ear,leg,eyes,tail"], ["./demo_images/tanager.jpg", "wing,eyes,back,legs,tail"] ], ) # demo.launch() demo.launch(server_name="0.0.0.0", debug=True)