Spaces:
Sleeping
Sleeping
import gradio as gr | |
from fastai.vision.all import * | |
learn = load_learner("export.pkl") | |
categories = ["Lala", "02"] | |
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 = ["lala.jpg", "02.png"] | |
title = "02 or lala classifier" | |
iface = gr.Interface( | |
fn=classify_img, | |
inputs=image, | |
outputs=label, | |
examples=examples, | |
title=title, | |
) | |
iface.launch(inline=False) | |