Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,21 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
|
5 |
+
learn = load_learner('export.pkl')
|
|
|
6 |
|
7 |
+
categories = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories, map(float,probs)))
|
12 |
+
|
13 |
+
image = gr.inputs.Image(shape=(100,100))
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
title = "Sign Language Digit Classifier"
|
16 |
+
description = "A sign language digit classifier trained on a Kaggle dataset with fastai. Created as a demo for fast.ai Part 1 v5 (2022)."
|
17 |
+
examples = ['7.jpg','8.jpg','OK.jpg']
|
18 |
+
interpretation='default'
|
19 |
+
enable_queue=True
|
20 |
+
|
21 |
+
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()
|