Spaces:
Runtime error
Runtime error
File size: 337 Bytes
75bced7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | import gradio as gr
from fastai.vision.all import *
learn = load_learner('model.pkl')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return {learn.dls.vocab[i]: float(probs[i]) for i in range(len(probs))}
demo = gr.Interface(
fn=classify_image,
inputs=gr.Image(),
outputs=gr.Label()
)
demo.launch() |