Spaces:
Sleeping
Sleeping
File size: 607 Bytes
e5a756f b32ee1e e5a756f b32ee1e e5a756f b32ee1e 1edf77b b32ee1e 1edf77b b32ee1e 4bd8e36 b32ee1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
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")
labels = model.dls.vocab
def predict(img):
img = PILImage.create(img)
pred, pred_idx, probs = model.predict(img)
return dict(zip(labels, map(float, probs)))
demo = gr.Interface(
fn=predict,
inputs=gr.inputs.Image(shape=(512, 512)),
outputs="image",
examples=examples,
title=title,
description=description,
).queue(default_concurrency_limit=5)
demo.launch()
|