Spaces:
Sleeping
Sleeping
File size: 436 Bytes
e28fc1d 7cff4ae e28fc1d 4e51fae a4e002d e28fc1d a4e002d e28fc1d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from pathlib import Path
from fastai.vision.all import *
import gradio as gr
learn = load_learner("fruits-model-v1.pkl")
def classify_fruit(img):
pred, idx, probs = learn.predict(img)
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
image = gr.Image(width=224, height=224, type="pil")
label = gr.Label()
inter = gr.Interface(fn=classify_fruit, inputs=image, outputs=label)
inter.launch(inline=False)
|