Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
learner = load_learner('braids_or_dreads_model.pkl') | |
labels = learner.dls.vocab | |
def predict(img): | |
_,_,probs = learner.predict(img) | |
return {labels[i]: float(probs[i]) for i in range(len(labels))} | |
examples = ['braids.jpg', 'braids-2.jpg', 'locks.jpg'] | |
gr.Interface( | |
fn=predict, | |
inputs=gr.inputs.Image(shape=(192,192)), | |
outputs=gr.outputs.Label(), | |
examples=examples | |
).launch(inline=False) | |