Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
categories = ["great white", "zebra", "whale", "lemon", "thresher"] | |
learner = load_learner("shark_recognizer.pkl") | |
def recognize_shark(img): | |
pred, idx, probs = learner.predict(img) | |
return dict(zip(categories, map(float, probs))) | |
image = gr.inputs.Image() | |
label = gr.outputs.Label() | |
iface = gr.Interface(fn=recognize_shark, inputs=image, outputs=label) | |
iface.launch() |