Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
learn = load_learner("first_model.pkl") | |
def classify_img(img): | |
categories = ["Suisei", "Toko"] | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
image = gr.inputs.Image(shape=(100, 100)) | |
label = gr.outputs.Label() | |
examples = ["suiseicz.png", "tokocz.jpg"] | |
iface = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples) | |
iface.launch(inline=False) | |