File size: 1,095 Bytes
9517f59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from Clip import run_detection_pipeline

print("Loading the application...")

iface = gr.Interface(
    fn=run_detection_pipeline,
    inputs = [
        gr.Image(type="pil", label="Upload Image"),
        gr.Textbox(label="Text Prompt", placeholder="e.g., a photo of a dog's face")
    ],
    outputs=[
        gr.Textbox(label="Result"),
        gr.Image(type="pil", label="Detection Result")
        ],
    title="GenMatch: Open-Vocabulary Object Detector",
    description="Upload an image and type what you want to find. The model will draw a box around it.",
    # Adding examples makes your app much easier to test and demonstrate!
    # Create a folder named 'examples' and put some images inside it.
    # examples=[
    #     [r"C:\Users\sahas\OneDrive\Desktop\GenMatch\Bounding Box.png", "Object detected and highlighted."],
    #     [r"C:\Users\sahas\OneDrive\Desktop\GenMatch\Photo of a dog.jpg", "Could not find '{prompt}' with enough confidence."],
    # ]
)

# Launch the app
if __name__ == "__main__":
    iface.launch(debug=True)