cars / app.py
adr's picture
Autogenerate app.py
306f319
raw
history blame contribute delete
No virus
604 Bytes
# AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
__all__ = ['classify_image', 'learner', 'categories']
# Cell
from fastai.vision.all import *
import gradio as gr
# Cell
learner = load_learner("model.pkl")
categories = "Formula 1","Indy","Nascar"
def classify_image(img):
pred,_,probs = learner.predict(img)
return dict(zip(categories, map(float, probs)))
# Cell
gr.Interface(
fn=classify_image,
inputs=gr.components.Image(shape=(192,192)),
outputs=gr.components.Label(),
examples=["formula-1.jpg", "indy.jpg", "nascar.jpg"],
).launch(inline=False)