Spaces:
Sleeping
Sleeping
File size: 618 Bytes
5a54ba8 e39965f 5a54ba8 a99615b 04bd733 a99615b 5a54ba8 3ee55c2 df77dac 5a54ba8 3ee55c2 5a54ba8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Cell
from fastai.vision.all import *
import gradio as gr
learn = load_learner('export.pkl')
categories = ('cup filled with coffee', 'cup filled with water')
def classify_image(img):
pred, idx, probs = learn.predict(img)
return dict(zip(categories, map(float, probs)))
label = gr.Label()
examples = ['cup_with_water.jpeg', 'cup_with_coffee.jpg']
intf = gr.Interface(fn=classify_image, inputs="image",
outputs=label, examples=examples, title="CupClassifier", description="Input an image of either (1) a cup filled with water or (2) a cup filled with coffee")
intf.launch(inline=False)
|