Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,24 +54,39 @@ def find_image_path(name):
|
|
54 |
def display_sign_language(english_text):
|
55 |
st.markdown("### 👐 Sign Language Representation")
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
# --- Streamlit UI ---
|
77 |
urdu_text = st.text_area("📝 Enter Urdu Text", height=150)
|
|
|
54 |
def display_sign_language(english_text):
|
55 |
st.markdown("### 👐 Sign Language Representation")
|
56 |
|
57 |
+
current_word = []
|
58 |
+
for char in english_text:
|
59 |
+
if char.isalpha():
|
60 |
+
current_word.append(char)
|
61 |
+
elif char == " ":
|
62 |
+
# Display current word vertically
|
63 |
+
if current_word:
|
64 |
+
st.markdown(f"**{''.join(current_word)}**")
|
65 |
+
for c in current_word:
|
66 |
+
img_path = find_image_path(c.lower())
|
67 |
+
if img_path:
|
68 |
+
st.image(img_path, caption=c.upper(), width=80)
|
69 |
+
else:
|
70 |
+
st.warning(f"Missing image for: {c.upper()}")
|
71 |
+
current_word = []
|
72 |
+
|
73 |
+
# Show space image
|
74 |
+
space_img = find_image_path("space")
|
75 |
+
if space_img:
|
76 |
+
st.image(space_img, caption="SPACE", width=40)
|
77 |
+
else:
|
78 |
+
continue # Skip punctuation
|
79 |
+
|
80 |
+
# Handle last word if any
|
81 |
+
if current_word:
|
82 |
+
st.markdown(f"**{''.join(current_word)}**")
|
83 |
+
for c in current_word:
|
84 |
+
img_path = find_image_path(c.lower())
|
85 |
+
if img_path:
|
86 |
+
st.image(img_path, caption=c.upper(), width=80)
|
87 |
+
else:
|
88 |
+
st.warning(f"Missing image for: {c.upper()}")
|
89 |
+
|
90 |
|
91 |
# --- Streamlit UI ---
|
92 |
urdu_text = st.text_area("📝 Enter Urdu Text", height=150)
|