Spaces:
Runtime error
Runtime error
File size: 559 Bytes
3f7bbd1 05cf264 8c186bb 05cf264 3f7bbd1 9f768a8 3f7bbd1 a5a505e a612299 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#Import necessary libraries
import gradio as gr
from fastai.vision.all import *
import skimage
bear_learner = load_learner('export.pkl')
#Create function that accepth image path and
labels = bear_learner.dls.vocab
def predict(img):
img = PILImage.create(img)
pred, idx, probs = bear_learner.predict(img)
return {labels[i]: round(float(probs[i]), 2) for i in range(len(labels))}
examples = ["black_bear.jpg", "teddy_bear.jpg"]
#interface =
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label()).launch() |