ahc / app.py
san94's picture
Changed the parameters of launch
6071fc8
from fastai.vision.all import *
import gradio as gr
classifier=load_learner("model.pkl")
labels = classifier.dls.vocab
def classify_image(img):
img = PILImage.create(img)
pred,pred_ix,pred_prob = classifier.predict(img)
return dict(zip(labels,map(float,pred_prob)))
images = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label(num_top_classes=4)
examples = ['airplane.jpg','helicopter.jpg','missile.jpg','rocketship.jpg']
intr = gr.Interface(fn = classify_image,inputs=images,outputs=label,examples=examples)
intr.launch(inline=False)