PARMESHWAR2 commited on
Commit
c995266
·
verified ·
1 Parent(s): 3bfc74c

Upload 5 files

Browse files
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Sign Language Demo
3
+ emoji: 😻
4
+ colorFrom: red
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.25.2
8
+ app_file: app.py
9
+ pinned: false
10
+ short_description: DEMO
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Unconfirmed 342298.crdownload ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ import tensorflow as tf
4
+ import cv2
5
+
6
+ # Load model
7
+ model = tf.keras.models.load_model("sign_language_model (1).h5")
8
+
9
+ # A-Z excluding J and Z
10
+ letters = [chr(i) for i in range(65, 91) if chr(i) not in ['J', 'Z']]
11
+
12
+ def predict_sign_language(image):
13
+ gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
14
+ resized = cv2.resize(gray, (28, 28))
15
+ normalized = resized / 255.0
16
+ reshaped = normalized.reshape(1, 28, 28, 1)
17
+ prediction = model.predict(reshaped)
18
+ pred_index = np.argmax(prediction)
19
+ predicted_letter = letters[pred_index]
20
+ confidence = float(np.max(prediction))
21
+ return f"{predicted_letter} (Confidence: {confidence:.2f})"
22
+
23
+ image_input = gr.Image(type="numpy", sources=["webcam", "upload"], label="Show a Hand Sign")
24
+
25
+ gr.Interface(
26
+ fn=predict_sign_language,
27
+ inputs=image_input,
28
+ outputs="text",
29
+ title="🤟 Sign Language Recognizer",
30
+ description="Use your webcam or upload an image of a hand sign (A-Z, except J & Z) to see prediction."
31
+ ).launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ tensorflow
3
+ opencv-python
sign_language_model%20%281%29.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cf2e42a9a010c2f4ec9e87731e56ef8a893a2fa4bc322b73ad3197ef88c26b9b
3
+ size 2762816
sign_language_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e4e578c695d70791f455a2f58bd91a2934232ff349d340b4776e2033cff87157
3
+ size 2764352