File size: 986 Bytes
7469cf1
 
d12c3b5
7469cf1
 
 
 
 
d12c3b5
5920c64
393d6df
 
7469cf1
cf5a0ee
5920c64
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
23
24
25
from fastai.vision.all import *
import gradio as gr
import logging

learn = load_learner('watersports.pkl')
categories = learn.dls.vocab

def classify_image(img):
    logging.warning('Watch out!')  # will print a message to the console
    print('Classifying ')
    pred,idx,probs = learn.predict(img)
    return( dict(zip(categories, map(float,probs))))

title = "Which Watersport? Compare your guess to the machine inferencing.x"
description = "CLick an image and click submit. 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)