Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
import dill | |
def is_cat(x): return x[0].isupper() | |
learn = load_learner('model.pkl', pickle_module=dill) | |
categories = ('Dog', 'Cat') | |
def classify_image(img): | |
pred, idx, probs = learn.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
image = gr.Image() | |
label = gr.Label() | |
examples = ['siamese.png'] | |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label) | |
intf.launch(inline=False) | |
# def greet(name, intensity): | |
# return "Hello, " + name + "!" * int(intensity) | |
# demo = gr.Interface( | |
# fn=greet, | |
# inputs=["text", "slider"], | |
# outputs=["text"], | |
# ) | |
# demo.launch() | |