Spaces:
Runtime error
Runtime error
from fastai.vision.all import * | |
import gradio as gr | |
categories = ('Chinese', 'Korean') | |
learn = load_learner('model.pkl') | |
def classify_image(img): | |
pred, idx, prob = learn.predict(img) | |
return dict(zip(categories, map(float, prob))) | |
image = gr.Image() | |
label = gr.Label() | |
examples = ['Beijing_hot_pot.jpg', 'chinese_hot_pot.jpg', 'Korean_hot_pot.jpg', 'dumpling_hot_pot.png'] | |
title = "Chinese vs. Korean Hot Pot Classifier " + "\U0001F60B" | |
description = "Built with <3 by your biggest hot pot fan!" | |
demo = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples, allow_flagging = "never", title=title, description=description) | |
demo.launch(inline=False) |