interstellar / app.py
Diego Carpintero
update description
a23788f
raw
history blame
745 Bytes
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()