Spaces:
Sleeping
Sleeping
import gradio as gr | |
from fastai.vision.all import * | |
title = "Interstellar Classifier" | |
description = "Built for fast.ai 'Practical Deep Learning'" | |
examples = "examples" | |
model = load_learner("model/model.pkl") | |
def predict(img): | |
labels = model.dls.vocab | |
img = PILImage.create(img) | |
pred, pred_idx, probs = model.predict(img) | |
return dict(map(labels, map(float, probs))) | |
demo = gr.Interface( | |
fn=predict, | |
inputs="image", | |
outputs="image", | |
examples=examples, | |
title=title, | |
description=description, | |
).queue(default_concurrency_limit=5) | |
demo.launch() | |