Spaces:
Sleeping
Sleeping
File size: 618 Bytes
1ab6be2 963e404 1ab6be2 5d5981a 1ab6be2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("object-detection", model="microsoft/table-transformer-detection")
def detect_objects(image):
result = pipe(image)
return [{"label": item["label"], "score": item["score"], "box": item["box"]} for item in result]
app = gr.Interface(
fn=detect_objects,
inputs=gr.Image(type="filepath"),
outputs=gr.JSON(),
title="Object Detection",
description="Upload an image to detect objects using Microsoft's Table Transformer model."
)
# Launch the app
if __name__ == "__main__":
app.launch()
|