Spaces:
Sleeping
Sleeping
from fastai.vision.all import * | |
import gradio as gr | |
learner = load_learner("model.pkl") | |
with open('categories.txt', 'r') as file: | |
categories = file.read().split("\n") | |
def classify_image(image): | |
pred,idx,probs = learner.predict(image) | |
return dict(zip(categories,map(float,probs))) | |
ins = gr.inputs.Image() | |
outs = gr.outputs.Label() | |
interface = gr.Interface(fn=classify_image,inputs=ins,outputs=outs) | |
interface.launch() |