Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
import torch as t | |
t.cuda.is_available() | |
def is_cat(x): return x[0].isupper() | |
l=load_learner('model.pkl') | |
cat=('dog','cat') | |
def classify(img): | |
s,i,p=l.predict(img) | |
return dict(zip(cat,map(float,p))) | |
image=gr.inputs.Image(shape=(192,192)) | |
label=gr.outputs.Label() | |
ex=['cat.jpg','dog.jpg','dunno.jpg'] | |
inf=gr.Interface(fn=classify,inputs=image,outputs=label,examples=ex) | |
inf.launch(inline=False) | |