Spaces:
Runtime error
Runtime error
from transformers import pipeline | |
from helper import load_image_from_url, render_results_in_image | |
od_pipe = pipeline("object-detection", "facebook/detr-resnet-50") | |
import gradio as gr | |
def get_pipeline_prediction(pil_image): | |
#first get the pipeline output given the pil image | |
pipeline_output = od_pipe(pil_image) | |
#then process the image using the pipeline output | |
processed_image = render_results_in_image(pil_image, pipeline_output) | |
return processed_image | |
demo = gr.Interface( | |
fn= get_pipeline_prediction, | |
inputs=gr.Image(label="Input Image", | |
type="pil"), | |
outputs=gr.Image(label="Output Image with predictions", | |
type="pil"), | |
title="Object Detection API", | |
description="Just upload your image and let ObjectDetect API work its magic, revealing the objects waiting to be discovered" | |
) | |
demo.launch() | |