Spaces:
Runtime error
Runtime error
Commit
·
926b4bc
1
Parent(s):
28310e2
Upload 3 files
Browse files- app.py +24 -0
- handpose.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__all__ = ['learn','classify_image','categories','image','label','examples','intf']
|
| 2 |
+
|
| 3 |
+
from fastai.vision.all import *
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
# Cell
|
| 7 |
+
learn = load_learner('handpose.pkl')
|
| 8 |
+
|
| 9 |
+
# Cell
|
| 10 |
+
categories = ('call', 'dislike', 'fist', 'four', 'like', 'mute', 'ok', 'one', 'palm', 'peace',
|
| 11 |
+
'peace_inverted', 'rock', 'stop', 'stop_inverted', 'three', 'three2', 'two_up', 'two_up_inverted')
|
| 12 |
+
|
| 13 |
+
def classify_image(img):
|
| 14 |
+
pred, idx, probs = learn.predict(img)
|
| 15 |
+
return dict(zip(categories, map(float, probs)))
|
| 16 |
+
|
| 17 |
+
# Cell
|
| 18 |
+
image = gr.inputs.Image(shape=(192,192),source='webcam')
|
| 19 |
+
label = gr.outputs.Label()
|
| 20 |
+
#examples = ['beyonce-ok.jpg','dalai-lama-one.jpg']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
| 24 |
+
intf.launch(inline=False)
|
handpose.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae10ad0053e07306173de79a2fe67b1391edf5722d45ce1d6512de6b270073df
|
| 3 |
+
size 47033899
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai
|