Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -69,10 +69,81 @@ translation_dict = {
|
|
69 |
"unthinkable": "μμλ ν μ μλ"
|
70 |
}
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
# Define the translation and text-to-speech function
|
73 |
def translate_and_speak(word):
|
74 |
korean_translation = translation_dict.get(word.lower(), "Translation not found")
|
75 |
-
tts = gTTS(
|
76 |
tts.save("translation.mp3")
|
77 |
return korean_translation, "translation.mp3"
|
78 |
|
|
|
69 |
"unthinkable": "μμλ ν μ μλ"
|
70 |
}
|
71 |
|
72 |
+
# Import libraries
|
73 |
+
import gradio as gr
|
74 |
+
from gtts import gTTS
|
75 |
+
|
76 |
+
# Simple dictionary for demonstration purposes
|
77 |
+
translation_dict = {
|
78 |
+
"passed": "μ§λκ°λ²λ¦°",
|
79 |
+
"beam": "λΉμ€κΈ°",
|
80 |
+
"electronic": "μ μμ",
|
81 |
+
"fascinate": "λ§μμ μ¬λ‘μ‘λ€, 맀λ£νλ€",
|
82 |
+
"comply": "λ°λ₯΄λ€",
|
83 |
+
"tradition": "μ ν΅",
|
84 |
+
"guard": "μ§ν€λ€, 보νΈνλ€, κ²½λΉλ₯Ό 보λ€",
|
85 |
+
"peak": "μ μ , μ μ , μ΅κ³ μ‘°, κΌλκΈ°",
|
86 |
+
"maintenance": "μ μ§, μνλΉ, μ§μ",
|
87 |
+
"harbor": "νꡬ, νλ§",
|
88 |
+
"condition": "μν, 쑰건",
|
89 |
+
"storm": "νν, νν",
|
90 |
+
"edged": "λ μ΄ μλ, κ°μ₯μλ¦¬κ° μλ",
|
91 |
+
"decide": "κ²°μ νλ€",
|
92 |
+
"elderly": "μ°μΈκ° λμ , λμ΄κ° λ ",
|
93 |
+
"realize": "κΉ¨λ«λ€, μμ차리λ€, μΈμνλ€",
|
94 |
+
"modern": "νλμ μΈ",
|
95 |
+
"grave": "무λ€, λ¬",
|
96 |
+
"generation": "μΈλ",
|
97 |
+
"cheaper": "λ μΌ, λ μ λ ΄ν",
|
98 |
+
"technology": "κΈ°μ ",
|
99 |
+
"fail": "μ€ν¨νλ€",
|
100 |
+
"proving": "κ²μ¦νλ€, μ
μ¦νλ€",
|
101 |
+
"require": "μꡬνλ€, νμνλ€, μμ²νλ€",
|
102 |
+
"climb": "μ€λ₯΄λ€, λ±λ°νλ€",
|
103 |
+
"stood": "standμ κ³Όκ±° λΆμ¬, μλ€, μΌμ΄μλ€",
|
104 |
+
"council": "μν",
|
105 |
+
"position": "μμΉ, μ리, λ°°μΉνλ€",
|
106 |
+
"navigation": "νν΄, μ΄ν",
|
107 |
+
"operation": "μλ, κ°λ, μ‘°μ",
|
108 |
+
"happen": "(μ¬κ±΄ λ±μ΄) μΌμ΄λλ€",
|
109 |
+
"lighthouse": "λ±λ",
|
110 |
+
"lantern": "μμ λ±, λν΄",
|
111 |
+
"vast": "μ΄λ§μ΄λ§ν, λ°©λν, λ§λν",
|
112 |
+
"relief": "μλ, μλκ°",
|
113 |
+
"importance": "μ€μμ±",
|
114 |
+
"grandson": "μμ, μΈμμ",
|
115 |
+
"fierce": "μ¬λμ΄, κ²©λ ¬ν, κ·Ήμ¬ν",
|
116 |
+
"panic": "κ·Ήμ¬ν 곡ν¬, κ²μ μ§λ € μ΄μ© μ€ λͺ¨λ₯΄λ€",
|
117 |
+
"proposed": "μ μλ",
|
118 |
+
"mariner": "μ μ, λ±μ¬λ",
|
119 |
+
"ensure": "λ°λμ ~νκ² νλ€, 보μ₯νλ€",
|
120 |
+
"responsibly": "μ±
μκ° μκ²",
|
121 |
+
"flickering": "κΉλ°κ±°λ¦¬λ, κΊΌμ§ κ² κ°μ, μ½ν",
|
122 |
+
"cliff": "μ λ²½",
|
123 |
+
"humble": "κ²Έμν, κ²Έννκ² λ§λ€λ€",
|
124 |
+
"severe": "κ·Ήμ¬ν, κ°νΉν, μν",
|
125 |
+
"efficiency": "ν¨μ¨, ν¨μ¨ν",
|
126 |
+
"familiar": "μ΅μν",
|
127 |
+
"guiding": "μΈλνλ, μλ΄νλ",
|
128 |
+
"jagged": "μμμμν, λ€μ₯λ μ₯ν",
|
129 |
+
"decision": "κ²°μ , κ²°λ¨λ ₯",
|
130 |
+
"disastrous": "μ²μ°Έν, ννΈμλ",
|
131 |
+
"heartbroken": "λΉν΅ν΄ νλ, μ¬νμ μ κΈ΄, λΉνμ μ μ",
|
132 |
+
"wisdom": "μ§ν",
|
133 |
+
"solution": "ν΄κ²°μ±
",
|
134 |
+
"miraculously": "κΈ°μ μ μΌλ‘",
|
135 |
+
"rush": "κΈν μμ§μ΄λ€, νΌμ‘, μΉλ°μ΄ μ€λ₯΄λ€",
|
136 |
+
"brewed": "λͺ°μμΉλ€",
|
137 |
+
"reinstated": "볡μ§νλ€, 볡κ·νλ€",
|
138 |
+
"enduring": "μ€λκ°λ",
|
139 |
+
"winding": "ꡬλΆκ΅¬λΆν",
|
140 |
+
"unthinkable": "μμλ ν μ μλ"
|
141 |
+
}
|
142 |
+
|
143 |
# Define the translation and text-to-speech function
|
144 |
def translate_and_speak(word):
|
145 |
korean_translation = translation_dict.get(word.lower(), "Translation not found")
|
146 |
+
tts = gTTS(word, lang='en') # Set lang to 'en' for English pronunciation
|
147 |
tts.save("translation.mp3")
|
148 |
return korean_translation, "translation.mp3"
|
149 |
|