Spaces:
Sleeping
Sleeping
# 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) | |