Spaces:
Runtime error
Runtime error
import gradio as gr | |
from fastai.vision.all import * | |
from duckduckgo_search import ddg_images | |
from pathlib import Path | |
examples = [i for i in Path("./examples").glob("*")] | |
categories = ["great white", "lemon", "thresher", "whale", "zebra"] | |
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, examples = examples) | |
iface.launch() |