Spaces:
Sleeping
Sleeping
File size: 433 Bytes
42bcb19 eaa4b35 71a8dbb 82ed154 71a8dbb f880739 71a8dbb 050df53 71a8dbb f880739 71a8dbb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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() |