Upload folder using huggingface_hub
Browse files- .gitattributes +10 -0
- app/__pycache__/main.cpython-311.pyc +0 -0
- app/assets/Hi.mp4 +3 -0
- app/assets/I.mp4 +3 -0
- app/assets/cat.mp4 +0 -0
- app/assets/dog.mp4 +0 -0
- app/assets/go.mp4 +0 -0
- app/assets/good morning.mp4 +3 -0
- app/assets/good.mp4 +0 -0
- app/assets/hello.mp4 +0 -0
- app/assets/how are you.mp4 +0 -0
- app/assets/my name.mp4 +0 -0
- app/assets/ok.mp4 +0 -0
- app/assets/school.mp4 +0 -0
- app/assets/thank you.mp4 +0 -0
- app/assets/that.mp4 +0 -0
- app/assets/turn right.mp4 +3 -0
- app/assets/wow.mp4 +0 -0
- app/assets/you are welcome.mp4 +0 -0
- app/main.py +18 -0
- app/models/hand_landmarker.task +3 -0
- app/models/labels.txt +5 -0
- app/models/lstm_model.tflite +3 -0
- app/models/vosk-model-small-en-us-0.15/README +9 -0
- app/models/vosk-model-small-en-us-0.15/am/final.mdl +3 -0
- app/models/vosk-model-small-en-us-0.15/conf/mfcc.conf +7 -0
- app/models/vosk-model-small-en-us-0.15/conf/model.conf +10 -0
- app/models/vosk-model-small-en-us-0.15/graph/Gr.fst +3 -0
- app/models/vosk-model-small-en-us-0.15/graph/HCLr.fst +3 -0
- app/models/vosk-model-small-en-us-0.15/graph/disambig_tid.int +17 -0
- app/models/vosk-model-small-en-us-0.15/graph/phones/word_boundary.int +166 -0
- app/models/vosk-model-small-en-us-0.15/ivector/final.dubm +3 -0
- app/models/vosk-model-small-en-us-0.15/ivector/final.ie +3 -0
- app/models/vosk-model-small-en-us-0.15/ivector/final.mat +0 -0
- app/models/vosk-model-small-en-us-0.15/ivector/global_cmvn.stats +3 -0
- app/models/vosk-model-small-en-us-0.15/ivector/online_cmvn.conf +1 -0
- app/models/vosk-model-small-en-us-0.15/ivector/splice.conf +2 -0
- app/routes/__pycache__/sign_to_speech.cpython-311.pyc +0 -0
- app/routes/__pycache__/speech_to_sign.cpython-311.pyc +0 -0
- app/routes/sign_to_speech.py +40 -0
- app/routes/speech_to_sign.py +26 -0
- app/services/__pycache__/hand_tracker_service.cpython-311.pyc +0 -0
- app/services/__pycache__/sign_generation_service.cpython-311.pyc +0 -0
- app/services/__pycache__/sign_recognition_service.cpython-311.pyc +0 -0
- app/services/__pycache__/speech_recognition_service.cpython-311.pyc +0 -0
- app/services/hand_tracker_service.py +40 -0
- app/services/sign_generation_service.py +33 -0
- app/services/sign_recognition_service.py +83 -0
- app/services/speech_recognition_service.py +30 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,13 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
app/assets/Hi.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
app/assets/I.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
app/assets/good[[:space:]]morning.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
app/assets/turn[[:space:]]right.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
app/models/hand_landmarker.task filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
app/models/vosk-model-small-en-us-0.15/am/final.mdl filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
app/models/vosk-model-small-en-us-0.15/graph/Gr.fst filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
app/models/vosk-model-small-en-us-0.15/graph/HCLr.fst filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
app/models/vosk-model-small-en-us-0.15/ivector/final.dubm filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
app/models/vosk-model-small-en-us-0.15/ivector/final.ie filter=lfs diff=lfs merge=lfs -text
|
app/__pycache__/main.cpython-311.pyc
ADDED
|
Binary file (1.38 kB). View file
|
|
|
app/assets/Hi.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a086923e0b775fd7688fb6466f566d04b954ce606c3f25a90f1b53ac444a6f4
|
| 3 |
+
size 102026
|
app/assets/I.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:80f3f61e6ef54066e7760b075579580924a347f9d13eaf8b0b7ac072bdc69dcd
|
| 3 |
+
size 131776
|
app/assets/cat.mp4
ADDED
|
Binary file (76.2 kB). View file
|
|
|
app/assets/dog.mp4
ADDED
|
Binary file (68.3 kB). View file
|
|
|
app/assets/go.mp4
ADDED
|
Binary file (80.9 kB). View file
|
|
|
app/assets/good morning.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:07b8d2e11b88be7ddddbf312847d4ee76eb6905dcbe9b811baad1f13fe276a8b
|
| 3 |
+
size 128671
|
app/assets/good.mp4
ADDED
|
Binary file (85.6 kB). View file
|
|
|
app/assets/hello.mp4
ADDED
|
Binary file (85.9 kB). View file
|
|
|
app/assets/how are you.mp4
ADDED
|
Binary file (82.3 kB). View file
|
|
|
app/assets/my name.mp4
ADDED
|
Binary file (22.4 kB). View file
|
|
|
app/assets/ok.mp4
ADDED
|
Binary file (57.9 kB). View file
|
|
|
app/assets/school.mp4
ADDED
|
Binary file (77.9 kB). View file
|
|
|
app/assets/thank you.mp4
ADDED
|
Binary file (81.5 kB). View file
|
|
|
app/assets/that.mp4
ADDED
|
Binary file (58.7 kB). View file
|
|
|
app/assets/turn right.mp4
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ec79781d4f700af4218f4a0a68c38ccbdcdeca9dbbbcd68f43aba7c5b6e6bfb
|
| 3 |
+
size 132573
|
app/assets/wow.mp4
ADDED
|
Binary file (61.7 kB). View file
|
|
|
app/assets/you are welcome.mp4
ADDED
|
Binary file (84.6 kB). View file
|
|
|
app/main.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from fastapi.staticfiles import StaticFiles
|
| 3 |
+
from app.routes import sign_to_speech, speech_to_sign
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
app = FastAPI(title="Sign-Speech Communication System API")
|
| 7 |
+
|
| 8 |
+
# Mount assets directory to serve video files
|
| 9 |
+
assets_path = os.path.join(os.path.dirname(__file__), "assets")
|
| 10 |
+
app.mount("/assets", StaticFiles(directory=assets_path), name="assets")
|
| 11 |
+
|
| 12 |
+
# Include routers
|
| 13 |
+
app.include_router(sign_to_speech.router, tags=["Sign-to-Speech"])
|
| 14 |
+
app.include_router(speech_to_sign.router, tags=["Speech-to-Sign"])
|
| 15 |
+
|
| 16 |
+
@app.get("/")
|
| 17 |
+
async def root():
|
| 18 |
+
return {"message": "Welcome to the Sign-Speech Communication System API"}
|
app/models/hand_landmarker.task
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fbc2a30080c3c557093b5ddfc334698132eb341044ccee322ccf8bcf3607cde1
|
| 3 |
+
size 7819105
|
app/models/labels.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
hello
|
| 2 |
+
help
|
| 3 |
+
no
|
| 4 |
+
thanks
|
| 5 |
+
yes
|
app/models/lstm_model.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:501ab2516879ee305590d1a15b0fa569cdcd1a459708580fd81e7ce5a54cfc02
|
| 3 |
+
size 333744
|
app/models/vosk-model-small-en-us-0.15/README
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
US English model for mobile Vosk applications
|
| 2 |
+
|
| 3 |
+
Copyright 2020 Alpha Cephei Inc
|
| 4 |
+
|
| 5 |
+
Accuracy: 10.38 (tedlium test) 9.85 (librispeech test-clean)
|
| 6 |
+
Speed: 0.11xRT (desktop)
|
| 7 |
+
Latency: 0.15s (right context)
|
| 8 |
+
|
| 9 |
+
|
app/models/vosk-model-small-en-us-0.15/am/final.mdl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75370a0137f9daf8f469dedd7daa4513ae7a621f03240c6e512e2b50b656a7b6
|
| 3 |
+
size 15962575
|
app/models/vosk-model-small-en-us-0.15/conf/mfcc.conf
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--sample-frequency=16000
|
| 2 |
+
--use-energy=false
|
| 3 |
+
--num-mel-bins=40
|
| 4 |
+
--num-ceps=40
|
| 5 |
+
--low-freq=20
|
| 6 |
+
--high-freq=7600
|
| 7 |
+
--allow-downsample=true
|
app/models/vosk-model-small-en-us-0.15/conf/model.conf
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--min-active=200
|
| 2 |
+
--max-active=3000
|
| 3 |
+
--beam=10.0
|
| 4 |
+
--lattice-beam=2.0
|
| 5 |
+
--acoustic-scale=1.0
|
| 6 |
+
--frame-subsampling-factor=3
|
| 7 |
+
--endpoint.silence-phones=1:2:3:4:5:6:7:8:9:10
|
| 8 |
+
--endpoint.rule2.min-trailing-silence=0.5
|
| 9 |
+
--endpoint.rule3.min-trailing-silence=0.75
|
| 10 |
+
--endpoint.rule4.min-trailing-silence=1.0
|
app/models/vosk-model-small-en-us-0.15/graph/Gr.fst
ADDED
|
|
Git LFS Details
|
app/models/vosk-model-small-en-us-0.15/graph/HCLr.fst
ADDED
|
|
Git LFS Details
|
app/models/vosk-model-small-en-us-0.15/graph/disambig_tid.int
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
10015
|
| 2 |
+
10016
|
| 3 |
+
10017
|
| 4 |
+
10018
|
| 5 |
+
10019
|
| 6 |
+
10020
|
| 7 |
+
10021
|
| 8 |
+
10022
|
| 9 |
+
10023
|
| 10 |
+
10024
|
| 11 |
+
10025
|
| 12 |
+
10026
|
| 13 |
+
10027
|
| 14 |
+
10028
|
| 15 |
+
10029
|
| 16 |
+
10030
|
| 17 |
+
10031
|
app/models/vosk-model-small-en-us-0.15/graph/phones/word_boundary.int
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1 nonword
|
| 2 |
+
2 begin
|
| 3 |
+
3 end
|
| 4 |
+
4 internal
|
| 5 |
+
5 singleton
|
| 6 |
+
6 nonword
|
| 7 |
+
7 begin
|
| 8 |
+
8 end
|
| 9 |
+
9 internal
|
| 10 |
+
10 singleton
|
| 11 |
+
11 begin
|
| 12 |
+
12 end
|
| 13 |
+
13 internal
|
| 14 |
+
14 singleton
|
| 15 |
+
15 begin
|
| 16 |
+
16 end
|
| 17 |
+
17 internal
|
| 18 |
+
18 singleton
|
| 19 |
+
19 begin
|
| 20 |
+
20 end
|
| 21 |
+
21 internal
|
| 22 |
+
22 singleton
|
| 23 |
+
23 begin
|
| 24 |
+
24 end
|
| 25 |
+
25 internal
|
| 26 |
+
26 singleton
|
| 27 |
+
27 begin
|
| 28 |
+
28 end
|
| 29 |
+
29 internal
|
| 30 |
+
30 singleton
|
| 31 |
+
31 begin
|
| 32 |
+
32 end
|
| 33 |
+
33 internal
|
| 34 |
+
34 singleton
|
| 35 |
+
35 begin
|
| 36 |
+
36 end
|
| 37 |
+
37 internal
|
| 38 |
+
38 singleton
|
| 39 |
+
39 begin
|
| 40 |
+
40 end
|
| 41 |
+
41 internal
|
| 42 |
+
42 singleton
|
| 43 |
+
43 begin
|
| 44 |
+
44 end
|
| 45 |
+
45 internal
|
| 46 |
+
46 singleton
|
| 47 |
+
47 begin
|
| 48 |
+
48 end
|
| 49 |
+
49 internal
|
| 50 |
+
50 singleton
|
| 51 |
+
51 begin
|
| 52 |
+
52 end
|
| 53 |
+
53 internal
|
| 54 |
+
54 singleton
|
| 55 |
+
55 begin
|
| 56 |
+
56 end
|
| 57 |
+
57 internal
|
| 58 |
+
58 singleton
|
| 59 |
+
59 begin
|
| 60 |
+
60 end
|
| 61 |
+
61 internal
|
| 62 |
+
62 singleton
|
| 63 |
+
63 begin
|
| 64 |
+
64 end
|
| 65 |
+
65 internal
|
| 66 |
+
66 singleton
|
| 67 |
+
67 begin
|
| 68 |
+
68 end
|
| 69 |
+
69 internal
|
| 70 |
+
70 singleton
|
| 71 |
+
71 begin
|
| 72 |
+
72 end
|
| 73 |
+
73 internal
|
| 74 |
+
74 singleton
|
| 75 |
+
75 begin
|
| 76 |
+
76 end
|
| 77 |
+
77 internal
|
| 78 |
+
78 singleton
|
| 79 |
+
79 begin
|
| 80 |
+
80 end
|
| 81 |
+
81 internal
|
| 82 |
+
82 singleton
|
| 83 |
+
83 begin
|
| 84 |
+
84 end
|
| 85 |
+
85 internal
|
| 86 |
+
86 singleton
|
| 87 |
+
87 begin
|
| 88 |
+
88 end
|
| 89 |
+
89 internal
|
| 90 |
+
90 singleton
|
| 91 |
+
91 begin
|
| 92 |
+
92 end
|
| 93 |
+
93 internal
|
| 94 |
+
94 singleton
|
| 95 |
+
95 begin
|
| 96 |
+
96 end
|
| 97 |
+
97 internal
|
| 98 |
+
98 singleton
|
| 99 |
+
99 begin
|
| 100 |
+
100 end
|
| 101 |
+
101 internal
|
| 102 |
+
102 singleton
|
| 103 |
+
103 begin
|
| 104 |
+
104 end
|
| 105 |
+
105 internal
|
| 106 |
+
106 singleton
|
| 107 |
+
107 begin
|
| 108 |
+
108 end
|
| 109 |
+
109 internal
|
| 110 |
+
110 singleton
|
| 111 |
+
111 begin
|
| 112 |
+
112 end
|
| 113 |
+
113 internal
|
| 114 |
+
114 singleton
|
| 115 |
+
115 begin
|
| 116 |
+
116 end
|
| 117 |
+
117 internal
|
| 118 |
+
118 singleton
|
| 119 |
+
119 begin
|
| 120 |
+
120 end
|
| 121 |
+
121 internal
|
| 122 |
+
122 singleton
|
| 123 |
+
123 begin
|
| 124 |
+
124 end
|
| 125 |
+
125 internal
|
| 126 |
+
126 singleton
|
| 127 |
+
127 begin
|
| 128 |
+
128 end
|
| 129 |
+
129 internal
|
| 130 |
+
130 singleton
|
| 131 |
+
131 begin
|
| 132 |
+
132 end
|
| 133 |
+
133 internal
|
| 134 |
+
134 singleton
|
| 135 |
+
135 begin
|
| 136 |
+
136 end
|
| 137 |
+
137 internal
|
| 138 |
+
138 singleton
|
| 139 |
+
139 begin
|
| 140 |
+
140 end
|
| 141 |
+
141 internal
|
| 142 |
+
142 singleton
|
| 143 |
+
143 begin
|
| 144 |
+
144 end
|
| 145 |
+
145 internal
|
| 146 |
+
146 singleton
|
| 147 |
+
147 begin
|
| 148 |
+
148 end
|
| 149 |
+
149 internal
|
| 150 |
+
150 singleton
|
| 151 |
+
151 begin
|
| 152 |
+
152 end
|
| 153 |
+
153 internal
|
| 154 |
+
154 singleton
|
| 155 |
+
155 begin
|
| 156 |
+
156 end
|
| 157 |
+
157 internal
|
| 158 |
+
158 singleton
|
| 159 |
+
159 begin
|
| 160 |
+
160 end
|
| 161 |
+
161 internal
|
| 162 |
+
162 singleton
|
| 163 |
+
163 begin
|
| 164 |
+
164 end
|
| 165 |
+
165 internal
|
| 166 |
+
166 singleton
|
app/models/vosk-model-small-en-us-0.15/ivector/final.dubm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c5d7dd69d2122313baaf19f61f35dd3fa18b70c62ac0687e311e1c46e6daca7
|
| 3 |
+
size 168048
|
app/models/vosk-model-small-en-us-0.15/ivector/final.ie
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3f37faf90c375b9e4740b569398b5829ed9cc07d19be6d441f72c3b71d7efcc6
|
| 3 |
+
size 8288887
|
app/models/vosk-model-small-en-us-0.15/ivector/final.mat
ADDED
|
Binary file (45 kB). View file
|
|
|
app/models/vosk-model-small-en-us-0.15/ivector/global_cmvn.stats
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
1.682383e+11 -1.1595e+10 -1.521733e+10 4.32034e+09 -2.257938e+10 -1.969666e+10 -2.559265e+10 -1.535687e+10 -1.276854e+10 -4.494483e+09 -1.209085e+10 -5.64008e+09 -1.134847e+10 -3.419512e+09 -1.079542e+10 -4.145463e+09 -6.637486e+09 -1.11318e+09 -3.479773e+09 -1.245932e+08 -1.386961e+09 6.560655e+07 -2.436518e+08 -4.032432e+07 4.620046e+08 -7.714964e+07 9.551484e+08 -4.119761e+08 8.208582e+08 -7.117156e+08 7.457703e+08 -4.3106e+08 1.202726e+09 2.904036e+08 1.231931e+09 3.629848e+08 6.366939e+08 -4.586172e+08 -5.267629e+08 -3.507819e+08 1.679838e+09
|
| 3 |
+
1.741141e+13 8.92488e+11 8.743834e+11 8.848896e+11 1.190313e+12 1.160279e+12 1.300066e+12 1.005678e+12 9.39335e+11 8.089614e+11 7.927041e+11 6.882427e+11 6.444235e+11 5.151451e+11 4.825723e+11 3.210106e+11 2.720254e+11 1.772539e+11 1.248102e+11 6.691599e+10 3.599804e+10 1.207574e+10 1.679301e+09 4.594778e+08 5.821614e+09 1.451758e+10 2.55803e+10 3.43277e+10 4.245286e+10 4.784859e+10 4.988591e+10 4.925451e+10 5.074584e+10 4.9557e+10 4.407876e+10 3.421443e+10 3.138606e+10 2.539716e+10 1.948134e+10 1.381167e+10 0 ]
|
app/models/vosk-model-small-en-us-0.15/ivector/online_cmvn.conf
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
# configuration file for apply-cmvn-online, used in the script ../local/run_online_decoding.sh
|
app/models/vosk-model-small-en-us-0.15/ivector/splice.conf
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
--left-context=3
|
| 2 |
+
--right-context=3
|
app/routes/__pycache__/sign_to_speech.cpython-311.pyc
ADDED
|
Binary file (2.23 kB). View file
|
|
|
app/routes/__pycache__/speech_to_sign.cpython-311.pyc
ADDED
|
Binary file (1.69 kB). View file
|
|
|
app/routes/sign_to_speech.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import APIRouter, UploadFile, File, HTTPException
|
| 2 |
+
from app.services.hand_tracker_service import HandTracker
|
| 3 |
+
from app.services.sign_recognition_service import GestureRecognizer
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
import io
|
| 7 |
+
from PIL import Image
|
| 8 |
+
|
| 9 |
+
router = APIRouter()
|
| 10 |
+
|
| 11 |
+
# Initialize services
|
| 12 |
+
tracker = HandTracker()
|
| 13 |
+
recognizer = GestureRecognizer()
|
| 14 |
+
|
| 15 |
+
@router.post("/sign-to-speech")
|
| 16 |
+
async def sign_to_speech(file: UploadFile = File(...)):
|
| 17 |
+
try:
|
| 18 |
+
# Read image
|
| 19 |
+
contents = await file.read()
|
| 20 |
+
nparr = np.frombuffer(contents, np.uint8)
|
| 21 |
+
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
| 22 |
+
|
| 23 |
+
if img is None:
|
| 24 |
+
raise HTTPException(status_code=400, detail="Invalid image file")
|
| 25 |
+
|
| 26 |
+
# Detect hands
|
| 27 |
+
tracker.find_hands(img)
|
| 28 |
+
lm_list = tracker.get_landmark_data()
|
| 29 |
+
|
| 30 |
+
if lm_list:
|
| 31 |
+
prediction = recognizer.process_landmarks(lm_list)
|
| 32 |
+
if prediction:
|
| 33 |
+
return prediction
|
| 34 |
+
return {"text": "Processing...", "confidence": 0.0}
|
| 35 |
+
else:
|
| 36 |
+
recognizer.clear()
|
| 37 |
+
return {"text": "No Hand Detected", "confidence": 0.0}
|
| 38 |
+
|
| 39 |
+
except Exception as e:
|
| 40 |
+
raise HTTPException(status_code=500, detail=str(e))
|
app/routes/speech_to_sign.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import APIRouter, UploadFile, File, HTTPException, Form
|
| 2 |
+
from app.services.speech_recognition_service import SpeechRecognitionService
|
| 3 |
+
from app.services.sign_generation_service import SignGenerationService
|
| 4 |
+
|
| 5 |
+
router = APIRouter()
|
| 6 |
+
|
| 7 |
+
# Initialize services
|
| 8 |
+
speech_service = SpeechRecognitionService()
|
| 9 |
+
sign_service = SignGenerationService()
|
| 10 |
+
|
| 11 |
+
@router.post("/speech-to-sign")
|
| 12 |
+
async def speech_to_sign(file: UploadFile = File(...), samplerate: int = Form(16000)):
|
| 13 |
+
try:
|
| 14 |
+
audio_data = await file.read()
|
| 15 |
+
text = speech_service.transcribe_full(audio_data, samplerate)
|
| 16 |
+
|
| 17 |
+
if not text:
|
| 18 |
+
return {"text": "", "sign_sequence": []}
|
| 19 |
+
|
| 20 |
+
sequence = sign_service.get_sign_sequence(text)
|
| 21 |
+
return {
|
| 22 |
+
"text": text,
|
| 23 |
+
"sign_sequence": sequence
|
| 24 |
+
}
|
| 25 |
+
except Exception as e:
|
| 26 |
+
raise HTTPException(status_code=500, detail=str(e))
|
app/services/__pycache__/hand_tracker_service.cpython-311.pyc
ADDED
|
Binary file (3.05 kB). View file
|
|
|
app/services/__pycache__/sign_generation_service.cpython-311.pyc
ADDED
|
Binary file (2.34 kB). View file
|
|
|
app/services/__pycache__/sign_recognition_service.cpython-311.pyc
ADDED
|
Binary file (5.63 kB). View file
|
|
|
app/services/__pycache__/speech_recognition_service.cpython-311.pyc
ADDED
|
Binary file (2.8 kB). View file
|
|
|
app/services/hand_tracker_service.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cv2
|
| 2 |
+
import numpy as np
|
| 3 |
+
import mediapipe as mp
|
| 4 |
+
from mediapipe.tasks import python
|
| 5 |
+
from mediapipe.tasks.python import vision
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
class HandTracker:
|
| 9 |
+
def __init__(self, max_hands=1, detection_con=0.5, track_con=0.5, model_path=None):
|
| 10 |
+
if model_path is None:
|
| 11 |
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 12 |
+
model_path = os.path.join(base_dir, "models", "hand_landmarker.task")
|
| 13 |
+
|
| 14 |
+
base_options = python.BaseOptions(model_asset_path=model_path)
|
| 15 |
+
options = vision.HandLandmarkerOptions(
|
| 16 |
+
base_options=base_options,
|
| 17 |
+
num_hands=max_hands,
|
| 18 |
+
min_hand_detection_confidence=detection_con,
|
| 19 |
+
min_hand_presence_confidence=track_con
|
| 20 |
+
)
|
| 21 |
+
self.detector = vision.HandLandmarker.create_from_options(options)
|
| 22 |
+
self.results = None
|
| 23 |
+
|
| 24 |
+
def find_hands(self, img):
|
| 25 |
+
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 26 |
+
mp_image = mp.Image(image_format=mp.ImageFormat.SRGB, data=img_rgb)
|
| 27 |
+
self.results = self.detector.detect(mp_image)
|
| 28 |
+
return self.results
|
| 29 |
+
|
| 30 |
+
def get_landmark_data(self):
|
| 31 |
+
if self.results and self.results.hand_landmarks:
|
| 32 |
+
my_hand = self.results.hand_landmarks[0]
|
| 33 |
+
lm_list = []
|
| 34 |
+
for lm in my_hand:
|
| 35 |
+
lm_list.extend([lm.x, lm.y, lm.z])
|
| 36 |
+
return lm_list
|
| 37 |
+
return None
|
| 38 |
+
|
| 39 |
+
def close(self):
|
| 40 |
+
self.detector.close()
|
app/services/sign_generation_service.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
class SignGenerationService:
|
| 4 |
+
def __init__(self, assets_dir=None):
|
| 5 |
+
if assets_dir is None:
|
| 6 |
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 7 |
+
assets_dir = os.path.join(base_dir, "assets")
|
| 8 |
+
self.assets_dir = assets_dir
|
| 9 |
+
self.assets_map = self._build_assets_map()
|
| 10 |
+
|
| 11 |
+
def _build_assets_map(self):
|
| 12 |
+
assets_map = {}
|
| 13 |
+
if not os.path.exists(self.assets_dir):
|
| 14 |
+
return assets_map
|
| 15 |
+
|
| 16 |
+
for filename in os.listdir(self.assets_dir):
|
| 17 |
+
name = os.path.splitext(filename)[0].lower()
|
| 18 |
+
assets_map[name] = filename
|
| 19 |
+
return assets_map
|
| 20 |
+
|
| 21 |
+
def get_sign_sequence(self, text):
|
| 22 |
+
if not text:
|
| 23 |
+
return []
|
| 24 |
+
|
| 25 |
+
words = text.lower().strip().split()
|
| 26 |
+
sequence = []
|
| 27 |
+
for word in words:
|
| 28 |
+
if word in self.assets_map:
|
| 29 |
+
sequence.append({
|
| 30 |
+
"word": word,
|
| 31 |
+
"asset": self.assets_map[word]
|
| 32 |
+
})
|
| 33 |
+
return sequence
|
app/services/sign_recognition_service.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
try:
|
| 5 |
+
import tensorflow as tf
|
| 6 |
+
tflite = tf.lite
|
| 7 |
+
except ImportError:
|
| 8 |
+
try:
|
| 9 |
+
import tflite_runtime.interpreter as tflite
|
| 10 |
+
except ImportError:
|
| 11 |
+
raise ImportError("Neither tensorflow nor tflite_runtime is installed.")
|
| 12 |
+
|
| 13 |
+
class GestureRecognizer:
|
| 14 |
+
def __init__(self, model_path=None, label_path=None, threshold=0.8):
|
| 15 |
+
self.threshold = threshold
|
| 16 |
+
self.sequence_length = 30
|
| 17 |
+
self.sequence_buffer = []
|
| 18 |
+
|
| 19 |
+
# Determine paths relative to this file
|
| 20 |
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # app/
|
| 21 |
+
if model_path is None:
|
| 22 |
+
model_path = os.path.join(base_dir, "models", "lstm_model.tflite")
|
| 23 |
+
if label_path is None:
|
| 24 |
+
label_path = os.path.join(base_dir, "models", "labels.txt")
|
| 25 |
+
|
| 26 |
+
# Load Labels
|
| 27 |
+
self.labels = []
|
| 28 |
+
try:
|
| 29 |
+
with open(label_path, "r") as f:
|
| 30 |
+
self.labels = [line.strip() for line in f.readlines()]
|
| 31 |
+
except FileNotFoundError:
|
| 32 |
+
print(f"Warning: {label_path} not found.")
|
| 33 |
+
|
| 34 |
+
# Load Model
|
| 35 |
+
try:
|
| 36 |
+
# We use the Interpreter class from whichever module we imported
|
| 37 |
+
if hasattr(tflite, 'Interpreter'):
|
| 38 |
+
self.interpreter = tflite.Interpreter(model_path=model_path)
|
| 39 |
+
else:
|
| 40 |
+
# Some versions of tflite_runtime have it at the top level
|
| 41 |
+
self.interpreter = tflite(model_path=model_path)
|
| 42 |
+
|
| 43 |
+
self.interpreter.allocate_tensors()
|
| 44 |
+
self.input_details = self.interpreter.get_input_details()
|
| 45 |
+
self.output_details = self.interpreter.get_output_details()
|
| 46 |
+
except Exception as e:
|
| 47 |
+
print(f"Error loading LSTM model: {e}")
|
| 48 |
+
raise
|
| 49 |
+
|
| 50 |
+
def process_landmarks(self, landmarks):
|
| 51 |
+
lm_np = np.array(landmarks)
|
| 52 |
+
wrist = lm_np[:3]
|
| 53 |
+
relative_lm = lm_np - np.tile(wrist, 21)
|
| 54 |
+
|
| 55 |
+
self.sequence_buffer.append(relative_lm)
|
| 56 |
+
if len(self.sequence_buffer) > self.sequence_length:
|
| 57 |
+
self.sequence_buffer.pop(0)
|
| 58 |
+
|
| 59 |
+
if len(self.sequence_buffer) == self.sequence_length:
|
| 60 |
+
return self._predict()
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
def _predict(self):
|
| 64 |
+
input_data = np.array([self.sequence_buffer], dtype=np.float32)
|
| 65 |
+
try:
|
| 66 |
+
self.interpreter.set_tensor(self.input_details[0]['index'], input_data)
|
| 67 |
+
self.interpreter.invoke()
|
| 68 |
+
output_data = self.interpreter.get_tensor(self.output_details[0]['index'])
|
| 69 |
+
prediction = np.squeeze(output_data)
|
| 70 |
+
max_index = np.argmax(prediction)
|
| 71 |
+
confidence = prediction[max_index]
|
| 72 |
+
|
| 73 |
+
if confidence > self.threshold:
|
| 74 |
+
return {
|
| 75 |
+
"text": self.labels[max_index] if self.labels else str(max_index),
|
| 76 |
+
"confidence": float(confidence)
|
| 77 |
+
}
|
| 78 |
+
except Exception as e:
|
| 79 |
+
print(f"Inference error: {e}")
|
| 80 |
+
return None
|
| 81 |
+
|
| 82 |
+
def clear(self):
|
| 83 |
+
self.sequence_buffer = []
|
app/services/speech_recognition_service.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
import vosk
|
| 4 |
+
|
| 5 |
+
class SpeechRecognitionService:
|
| 6 |
+
def __init__(self, model_path=None):
|
| 7 |
+
if model_path is None:
|
| 8 |
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 9 |
+
model_path = os.path.join(base_dir, "models", "vosk-model-small-en-us-0.15")
|
| 10 |
+
|
| 11 |
+
if not os.path.exists(model_path):
|
| 12 |
+
raise FileNotFoundError(f"Vosk model not found at {model_path}")
|
| 13 |
+
|
| 14 |
+
print(f"Loading Vosk model from {model_path}...")
|
| 15 |
+
self.model = vosk.Model(model_path)
|
| 16 |
+
|
| 17 |
+
def transcribe(self, audio_data, samplerate):
|
| 18 |
+
recognizer = vosk.KaldiRecognizer(self.model, samplerate)
|
| 19 |
+
if recognizer.AcceptWaveform(audio_data):
|
| 20 |
+
result = json.loads(recognizer.Result())
|
| 21 |
+
return result.get("text", "")
|
| 22 |
+
else:
|
| 23 |
+
partial = json.loads(recognizer.PartialResult())
|
| 24 |
+
return partial.get("partial", "")
|
| 25 |
+
|
| 26 |
+
def transcribe_full(self, audio_data, samplerate):
|
| 27 |
+
recognizer = vosk.KaldiRecognizer(self.model, samplerate)
|
| 28 |
+
recognizer.AcceptWaveform(audio_data)
|
| 29 |
+
result = json.loads(recognizer.FinalResult())
|
| 30 |
+
return result.get("text", "")
|