Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,37 @@ from mediapipe.tasks.python import vision
|
|
5 |
import gradio as gr
|
6 |
import os
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
def recognize_gesture(image):
|
9 |
# Load the gesture recognition model
|
10 |
model_path = os.path.abspath("arabic_signlanguage_characters_model.task")
|
@@ -24,7 +55,7 @@ def recognize_gesture(image):
|
|
24 |
top_gesture = recognition_result.gestures[0][0]
|
25 |
|
26 |
# Return the gesture label and score
|
27 |
-
return f"Gesture recognized: {top_gesture.category_name} ({top_gesture.score:.2f})"
|
28 |
|
29 |
iface = gr.Interface(
|
30 |
fn=recognize_gesture,
|
|
|
5 |
import gradio as gr
|
6 |
import os
|
7 |
|
8 |
+
eng_ara_mapping ={
|
9 |
+
' ':' ',
|
10 |
+
"ain":'ع',
|
11 |
+
"aleff":'أ',
|
12 |
+
"bb":'ب',
|
13 |
+
"dal":'د',
|
14 |
+
"dha":'ط',
|
15 |
+
"dhad":"ض",
|
16 |
+
"fa":"ف",
|
17 |
+
"gaaf":'ق',
|
18 |
+
"ghain":'غ',
|
19 |
+
"ha":'ه',
|
20 |
+
"haa":'ح',
|
21 |
+
"jeem":'ج',
|
22 |
+
"kaaf":'ك',
|
23 |
+
"laam":'ل',
|
24 |
+
"meem":'م',
|
25 |
+
"nun":"ن",
|
26 |
+
"ra":'ر',
|
27 |
+
"saad":'ص',
|
28 |
+
"seen":'س',
|
29 |
+
"sheen":"ش",
|
30 |
+
"ta":'ت',
|
31 |
+
"taa":'ط',
|
32 |
+
"thaa":"ث",
|
33 |
+
"thal":"ذ",
|
34 |
+
"waw":'و',
|
35 |
+
"ya":"ى",
|
36 |
+
"zay":'ز',
|
37 |
+
"khaa":'خ' }
|
38 |
+
|
39 |
def recognize_gesture(image):
|
40 |
# Load the gesture recognition model
|
41 |
model_path = os.path.abspath("arabic_signlanguage_characters_model.task")
|
|
|
55 |
top_gesture = recognition_result.gestures[0][0]
|
56 |
|
57 |
# Return the gesture label and score
|
58 |
+
return f"Gesture recognized: {eng_ara_mapping.pop(top_gesture.category_name)} ({top_gesture.score:.2f})"
|
59 |
|
60 |
iface = gr.Interface(
|
61 |
fn=recognize_gesture,
|