maverickmohini/Mohini_Intent_Classification
0
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 