File size: 835 Bytes
eebcf59
 
 
 
ae61587
eebcf59
 
 
 
 
 
 
 
 
 
782a99f
eebcf59
601e2a4
eebcf59
 
f0c3c75
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from fastai.vision.all import *
import skimage

learn = load_learner('model.pkl')

categories = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')

def classify_image(img):
  pred,idx,probs = learn.predict(img)
  return dict(zip(categories, map(float,probs)))

image = gr.inputs.Image(shape=(100,100))
label = gr.outputs.Label()
title = "Sign Language Digit Classifier"
description = "A sign language digit classifier trained on a Kaggle dataset with fast.ai. Click on an example (6, 7, and 8) or upload an image and let the model classify it for you!"
interpretation='default'
examples= ['6.JPG', '7.JPG', '8.JPG']
enable_queue=True

gr.Interface(fn=classify_image,inputs=gr.inputs.Image(shape=(100, 100)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,examples=examples).launch()