File size: 859 Bytes
7469cf1
 
 
 
 
 
 
393d6df
 
7469cf1
e5c6c96
 
 
7469cf1
 
 
 
 
eacf2f7
7469cf1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)