ananthvk's picture
update requirements
7cff4ae
raw
history blame contribute delete
436 Bytes
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)