File size: 617 Bytes
080a74c
 
 
 
 
 
 
 
 
 
 
 
 
7e24a98
080a74c
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
from fastai.vision.all import *
import skimage
learn = load_learner("asl-baseline.pkl")

labels = learn.dls.vocab

def classify_asl(img):
    img = PILImage.create(img)
    pred,idx,probs  = learn.predict(img)
    return {labels[i]: float(probs[i]) for i in range(len(labels))}

image = gr.inputs.Image(shape = (128,128))
label = gr.outputs.Label(num_top_classes=29)
title = "ASL Classifier"
interpretation='default'
enable_queue=True

iface = gr.Interface(fn=classify_asl, inputs=image, outputs=label,title=title,interpretation=interpretation,enable_queue=enable_queue)
iface.launch(inline=False)