import gradio as gr from fastai.vision.all import * learn = load_learner('20250123_squish_model.pkl') #labels = learn.dls.vocab labels=['Comfort Food Squishable', 'Plague-related Squishable', 'Standard Squish', 'Undercover Squishable!' ] def predict(img): img = PILImage.create(img) pred,pred_idx,probs = learn.predict(img) return {labels[i]: float(probs[i]) for i in range(len(labels))} title = "Squishable Type Classifier" description = "A squishable classifier trained with fastai. Do you have a Standard Squish? Undercover? Comfort Food? Let's find out!
Created as a demo for Gradio and HuggingFace Spaces." article="

Blog post

" gr.Interface(fn=predict, inputs=gr.components.Image(height=214, width=214), outputs=gr.components.Label(num_top_classes=3), title=title, description=description, article=article, ).queue(max_size=3 ).launch()