import gradio as gr from demo import query_image description = """ Gradio demo for OWL-ViT, introduced in Simple Open-Vocabulary Object Detection with Vision Transformers. \n\nYou can use OWL-ViT to query images with text descriptions of any object. To use it, simply upload an image and enter comma separated text descriptions of objects you want to query the image for. You can also use the score threshold slider to set a threshold to filter out low probability predictions. \n\nOWL-ViT is trained on text templates, hence you can get better predictions by querying the image with text templates used in training the original model: *"photo of a star-spangled banner"*, *"image of a shoe"*. Refer to the CLIP paper to see the full list of text templates used to augment the training data. \n\nColab demo """ demo = gr.Interface( query_image, inputs=[gr.Image(), "text", gr.Slider(0, 1, value=0.1)], outputs="image", title="Zero-Shot Object Detection with OWL-ViT", description=description, examples=[ ["./demo_images/cats.png", "cats,ears", 0.11], ["./demo_images/demo1.jpg", "bear,soil,sea", 0.1], ["./demo_images/demo2.jpg", "dog,ear,leg,eyes,tail", 0.1], ["./demo_images/tanager.jpg", "wing,eyes,back,legs,tail", 0.01] ], ) # demo.launch() demo.launch(server_name="0.0.0.0", debug=True)