model / app.py
stephen9686's picture
Create app.py
75bced7 verified
raw
history blame contribute delete
337 Bytes
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()