from transformers import pipeline od_pipe = pipeline("object-detection", "facebook/detr-resnet-50") import os import gradio as gr from helper import render_results_in_image def get_pipeline_prediction(pil_image): pipeline_output = od_pipe(pil_image) processed_image = render_results_in_image(pil_image, pipeline_output) return processed_image object_detection_app = gr.Interface( fn=get_pipeline_prediction, inputs=gr.Image(label="Input image", type="pil"), outputs=gr.Image(label="Output image with predicted instances", type="pil"), title = "Object Detection", description = "Facebook detr-resnet-50") with gr.Blocks() as demo: gr.TabbedInterface( [object_detection_app], ["Object Detection"]) demo.launch()