NDeee's picture
Create app.py
834b6ec verified
raw
history blame
569 Bytes
# Use a pipeline as a high-level helper
from transformers import pipeline
import gradio as gr
pipe = pipeline("image-classification", model="julien-c/hotdog-not-hotdog")
def predict(img):
predictions = pipe(img)
return img,{p["label"]:p["score"] for p in predictions}
interface = gr.Interface(
fn = predict,
inputs = gr.Image(label = "Select hot dog image", sources = ['upload', 'webcam'], type = 'pil'),
outputs = [gr.Image(label = "Processed Image"), gr.Label(label="Result", num_top_classes=2)],
title = "Hot Dog or Not?"
)
interface.launch()