WhichWatersport / app.py
Benjamin Coman
Expand examples per page.
eacf2f7
raw history blame
No virus
859 Bytes
from fastai.vision.all import *
import gradio as gr
learn = load_learner('watersports.pkl')
categories = learn.dls.vocab
def classify_image(img):
pred,idx,probs = learn.predict(img)
return( dict(zip(categories, map(float,probs))))
title = "Which Watersport? Test yourself before submitting to the machine learning classifier."
description = "Drag an image into the classifier. Take a close look and guess it yourself, before hitting **\<Submit\>**. \n \
You need to **\<Clear\>** before dragging next image. Other images can be dragged directly from google search."
image = gr.inputs.Image(shape=(192,192))
label = gr.outputs.Label()
examples = './examples'
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, \
examples=examples, examples_per_page=100, title=title, description=description)
iface.launch(inline=False)