Spaces:
Sleeping
Sleeping
File size: 745 Bytes
e5a756f b32ee1e e5a756f b32ee1e 956d1f2 42e90e2 b32ee1e e5a756f a23788f 1edf77b b32ee1e 1edf77b b32ee1e 42e90e2 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 28 29 30 31 32 |
import gradio as gr
from fastai.vision.all import *
title = "Interstellar Classifier"
description = (
"A naive Galaxy Classifier built for the fast.ai 'Deep Learning' "
"course by fine tuning ResNet50 (3 epochs) with a custom dataset "
"of images (150 per label)."
)
inputs = gr.components.Image()
outputs = gr.components.Label()
examples = "examples"
model = load_learner("model/model.pkl")
labels = model.dls.vocab
def predict(img):
pred, pred_idx, probs = model.predict(img)
return dict(zip(labels, map(float, probs)))
demo = gr.Interface(
fn=predict,
inputs=inputs,
outputs=outputs,
examples=examples,
title=title,
description=description,
).queue(default_concurrency_limit=5)
demo.launch()
|