Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -202,7 +202,7 @@ arabic_letters_data = [
|
|
| 202 |
"letter": "ق",
|
| 203 |
"image": os.path.join(IMAGE_DIR, "qaf.jpg"),
|
| 204 |
"audio": os.path.join(AUDIO_DIR, "qaf.wav"),
|
| 205 |
-
"word_example": "قرد (Qird - Monkey)",
|
| 206 |
"word_image": os.path.join(IMAGE_DIR, "qird.jpg"), # Corrected
|
| 207 |
"word_audio": os.path.join(AUDIO_DIR, "qird.wav"), # Corrected
|
| 208 |
},
|
|
@@ -210,7 +210,7 @@ arabic_letters_data = [
|
|
| 210 |
"letter": "ك",
|
| 211 |
"image": os.path.join(IMAGE_DIR, "kaf.jpg"),
|
| 212 |
"audio": os.path.join(AUDIO_DIR, "kaf.wav"),
|
| 213 |
-
"word_example": "كلب (Kalb - Dog)",
|
| 214 |
"word_image": os.path.join(IMAGE_DIR, "kalb.jpg"), # Corrected
|
| 215 |
"word_audio": os.path.join(AUDIO_DIR, "kalb.wav"), # Corrected
|
| 216 |
},
|
|
@@ -241,9 +241,9 @@ arabic_letters_data = [
|
|
| 241 |
},
|
| 242 |
{
|
| 243 |
"letter": "ه",
|
| 244 |
-
"image": os.path.join(IMAGE_DIR, "ha.jpg"),
|
| 245 |
"audio": os.path.join(AUDIO_DIR, "ha.wav"),
|
| 246 |
-
"word_example": "هاتف (Hatif - Telephone)",
|
| 247 |
"word_image": os.path.join(IMAGE_DIR, "hatif.jpg"), # Corrected
|
| 248 |
"word_audio": os.path.join(AUDIO_DIR, "hatif.wav"), # Corrected
|
| 249 |
},
|
|
@@ -322,10 +322,11 @@ def get_current_letter_content():
|
|
| 322 |
data = arabic_letters_data[current_letter_idx]
|
| 323 |
|
| 324 |
# Return (letter_image, letter_audio, word_example_display, word_image, word_audio)
|
|
|
|
| 325 |
return (
|
| 326 |
data["image"],
|
| 327 |
data["audio"], # This audio is for the letter sound itself
|
| 328 |
-
data["word_example"],
|
| 329 |
data["word_image"],
|
| 330 |
data["word_audio"] # This audio is for the word example sound
|
| 331 |
)
|
|
@@ -619,7 +620,7 @@ with gr.Blocks(
|
|
| 619 |
gr.Markdown("# <span style='color:#007bff;'>تطبيق تعلم العربية للأطفال</span>", rtl=True)
|
| 620 |
# Add logo image
|
| 621 |
gr.Image(
|
| 622 |
-
value=os.path.join(IMAGE_DIR, "Applogo.
|
| 623 |
label="شعار التطبيق (App Logo)",
|
| 624 |
width=300,
|
| 625 |
height=150,
|
|
@@ -666,13 +667,7 @@ with gr.Blocks(
|
|
| 666 |
|
| 667 |
# --- Word Example Section for the current letter ---
|
| 668 |
gr.Markdown("### <span style='color:#ffc107;'>كلمات تبدأ بهذا الحرف (Words starting with this letter)</span>", rtl=True)
|
| 669 |
-
#
|
| 670 |
-
word_example_display = gr.Markdown(
|
| 671 |
-
value="",
|
| 672 |
-
label="كلمة (Word)",
|
| 673 |
-
rtl=True,
|
| 674 |
-
elem_classes=["gr-markdown"]
|
| 675 |
-
)
|
| 676 |
# Display image for the example word
|
| 677 |
word_image = gr.Image(
|
| 678 |
label="صورة الكلمة (Word Image)",
|
|
@@ -781,7 +776,7 @@ with gr.Blocks(
|
|
| 781 |
outputs=[
|
| 782 |
letter_image,
|
| 783 |
letter_audio_output,
|
| 784 |
-
word_example_display,
|
| 785 |
word_image,
|
| 786 |
word_audio_output
|
| 787 |
],
|
|
@@ -795,7 +790,7 @@ with gr.Blocks(
|
|
| 795 |
outputs=[
|
| 796 |
letter_image,
|
| 797 |
letter_audio_output,
|
| 798 |
-
word_example_display,
|
| 799 |
word_image,
|
| 800 |
word_audio_output
|
| 801 |
]
|
|
@@ -806,7 +801,7 @@ with gr.Blocks(
|
|
| 806 |
outputs=[
|
| 807 |
letter_image,
|
| 808 |
letter_audio_output,
|
| 809 |
-
word_example_display,
|
| 810 |
word_image,
|
| 811 |
word_audio_output
|
| 812 |
]
|
|
|
|
| 202 |
"letter": "ق",
|
| 203 |
"image": os.path.join(IMAGE_DIR, "qaf.jpg"),
|
| 204 |
"audio": os.path.join(AUDIO_DIR, "qaf.wav"),
|
| 205 |
+
"word_example": "قرد (Qird - Monkey)",
|
| 206 |
"word_image": os.path.join(IMAGE_DIR, "qird.jpg"), # Corrected
|
| 207 |
"word_audio": os.path.join(AUDIO_DIR, "qird.wav"), # Corrected
|
| 208 |
},
|
|
|
|
| 210 |
"letter": "ك",
|
| 211 |
"image": os.path.join(IMAGE_DIR, "kaf.jpg"),
|
| 212 |
"audio": os.path.join(AUDIO_DIR, "kaf.wav"),
|
| 213 |
+
"word_example": "كلب (Kalb - Dog)",
|
| 214 |
"word_image": os.path.join(IMAGE_DIR, "kalb.jpg"), # Corrected
|
| 215 |
"word_audio": os.path.join(AUDIO_DIR, "kalb.wav"), # Corrected
|
| 216 |
},
|
|
|
|
| 241 |
},
|
| 242 |
{
|
| 243 |
"letter": "ه",
|
| 244 |
+
"image": os.path.join(IMAGE_DIR, "ha.jpg"),
|
| 245 |
"audio": os.path.join(AUDIO_DIR, "ha.wav"),
|
| 246 |
+
"word_example": "هاتف (Hatif - Telephone)",
|
| 247 |
"word_image": os.path.join(IMAGE_DIR, "hatif.jpg"), # Corrected
|
| 248 |
"word_audio": os.path.join(AUDIO_DIR, "hatif.wav"), # Corrected
|
| 249 |
},
|
|
|
|
| 322 |
data = arabic_letters_data[current_letter_idx]
|
| 323 |
|
| 324 |
# Return (letter_image, letter_audio, word_example_display, word_image, word_audio)
|
| 325 |
+
# Note: word_example is still returned for internal use if needed, but not displayed directly
|
| 326 |
return (
|
| 327 |
data["image"],
|
| 328 |
data["audio"], # This audio is for the letter sound itself
|
| 329 |
+
data["word_example"], # Keep this for `play_word_btn` to access the word's pronunciation
|
| 330 |
data["word_image"],
|
| 331 |
data["word_audio"] # This audio is for the word example sound
|
| 332 |
)
|
|
|
|
| 620 |
gr.Markdown("# <span style='color:#007bff;'>تطبيق تعلم العربية للأطفال</span>", rtl=True)
|
| 621 |
# Add logo image
|
| 622 |
gr.Image(
|
| 623 |
+
value=os.path.join(IMAGE_DIR, "Applogo.jpg"), # Path to your logo image
|
| 624 |
label="شعار التطبيق (App Logo)",
|
| 625 |
width=300,
|
| 626 |
height=150,
|
|
|
|
| 667 |
|
| 668 |
# --- Word Example Section for the current letter ---
|
| 669 |
gr.Markdown("### <span style='color:#ffc107;'>كلمات تبدأ بهذا الحرف (Words starting with this letter)</span>", rtl=True)
|
| 670 |
+
# Removed word_example_display gr.Markdown
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 671 |
# Display image for the example word
|
| 672 |
word_image = gr.Image(
|
| 673 |
label="صورة الكلمة (Word Image)",
|
|
|
|
| 776 |
outputs=[
|
| 777 |
letter_image,
|
| 778 |
letter_audio_output,
|
| 779 |
+
word_example_display, # word_example_display is still in outputs for the function to return
|
| 780 |
word_image,
|
| 781 |
word_audio_output
|
| 782 |
],
|
|
|
|
| 790 |
outputs=[
|
| 791 |
letter_image,
|
| 792 |
letter_audio_output,
|
| 793 |
+
word_example_display, # Still in outputs
|
| 794 |
word_image,
|
| 795 |
word_audio_output
|
| 796 |
]
|
|
|
|
| 801 |
outputs=[
|
| 802 |
letter_image,
|
| 803 |
letter_audio_output,
|
| 804 |
+
word_example_display, # Still in outputs
|
| 805 |
word_image,
|
| 806 |
word_audio_output
|
| 807 |
]
|