|
import gradio as gr |
|
from PIL import Image |
|
from object_detection import run_od_pipeline |
|
|
|
def detect_objects(image: Image.Image) -> Image.Image: |
|
return run_od_pipeline(image) |
|
|
|
|
|
title = "🧠 Object Detection using Hugging Face" |
|
description = "Upload an image and run object detection powered by Hugging Face models." |
|
|
|
demo = gr.Interface( |
|
fn=detect_objects, |
|
inputs=gr.Image(type="pil", label="Upload an image"), |
|
outputs=gr.Image(type="pil", label="Detected Objects"), |
|
title=title, |
|
description=description, |
|
theme="default", |
|
allow_flagging="never" |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |
|
|