File size: 642 Bytes
8c95b6f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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)
# Gradio Interface
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()
|