Spaces:
Sleeping
Sleeping
File size: 403 Bytes
78790a7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
from fastai.vision.all import *
learn = load_learner("cat.pkl")
classes = learn.vocab
examples = learn.examples
def classify_image(img):
probs = learn.predict(img)[2]
return dict(zip(classes, map(float, probs)))
image = gr.Image()
label = gr.Label(num_top_classes=5)
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
intf.launch()
|