Team Ai
Apppublic

maverickmohini/Mohini_Intent_Classification

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
app.py19 linesDownload Raw Back to root
1import gradio as gr2from transformers import pipeline3 4MODEL_ID = "nateraw/food"  # <- replace with any model above5clf = pipeline("image-classification", model=MODEL_ID)6 7def predict(img):8    out = clf(img)9    # show top-3 with scores10    out = sorted(out, key=lambda r: r["score"], reverse=True)[:3]11    return {r["label"]: float(r["score"]) for r in out}12 13gr.Interface(14    fn=predict,15    inputs=gr.Image(type="pil", label="Upload image"),16    outputs=gr.Label(num_top_classes=3),17    title="Image Classifier (pre-tuned)",18).launch()19