captain-awesome's picture
Create app.py
6b07f33 verified
raw
history blame
668 Bytes
import gradio as gr
from transformers import pipeline
from PIL import Image
from helper import load_image_from_url, render_results_in_image
def get_pipeline_prediction(pil_image):
od_pipe = pipeline("object-detection", "facebook/detr-resnet-50")
pipeline_output = od_pipe(pil_image)
processed_image = render_results_in_image(pil_image,
pipeline_output)
return processed_image
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")
)