radio / app.py
Saksak65's picture
Update app.py
6aced80 verified
raw
history blame contribute delete
373 Bytes
from transformers import pipeline
import gradio as gr
classifier = pipeline(
"image-classification",
model="nateraw/food"
)
def predict(image):
results = classifier(image)
return {r["label"]: float(r["score"]) for r in results}
demo = gr.Interface(
fn=predict,
inputs=gr.Image(type="pil"),
outputs=gr.Label(num_top_classes=3)
)
demo.launch()