Spaces:
Runtime error
Runtime error
File size: 562 Bytes
8a8e85d 05df4cf 8a8e85d 56ae424 d075f10 8a8e85d 2738daa 56ae424 2738daa 56ae424 05df4cf 56ae424 2738daa |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner("first_model.pkl")
categories = ["Hoshimachi Suisei", "Inui Toko"]
def classify_img(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
image = gr.inputs.Image(shape=(128, 128))
label = gr.outputs.Label()
examples = ["suiseicz.png", "tokocz.jpg"]
title = "Toko and Suisei classifier"
iface = gr.Interface(
fn=classify_img,
inputs=image,
outputs=label,
examples=examples,
title=title,
)
iface.launch(inline=False)
|