Spaces:
Runtime error
Runtime error
File size: 618 Bytes
649da6e b6c3cac 649da6e 43a8f91 649da6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from fastai.vision.all import *
learn_inf = load_learner('model.pkl')
categories = learn_inf.dls.vocab
def classify_image(img):
pred,pred_idx,probs = learn_inf.predict(img)
return dict(zip(categories, map(float, probs)))
iface = gr.Interface(
title = "Is it an edible fungus?",
description = "An image classifier that tells if a fungus is edible or not",
fn=classify_image,
inputs=gr.Image(shape=(224,224)),
outputs=gr.outputs.Label(),
examples=['examples/porcini.jpg', 'examples/amanitamuscaria.jpg'],
live=True,
enable_queue=True
)
iface.launch() |