Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,75 +1,3 @@
|
|
1 |
-
# Import libraries
|
2 |
-
import gradio as gr
|
3 |
-
from gtts import gTTS
|
4 |
-
|
5 |
-
# Simple dictionary for demonstration purposes
|
6 |
-
translation_dict = {
|
7 |
-
"passed": "μ§λκ°λ²λ¦°",
|
8 |
-
"beam": "λΉμ€κΈ°",
|
9 |
-
"electronic": "μ μμ",
|
10 |
-
"fascinate": "λ§μμ μ¬λ‘μ‘λ€, 맀λ£νλ€",
|
11 |
-
"comply": "λ°λ₯΄λ€",
|
12 |
-
"tradition": "μ ν΅",
|
13 |
-
"guard": "μ§ν€λ€, 보νΈνλ€, κ²½λΉλ₯Ό 보λ€",
|
14 |
-
"peak": "μ μ , μ μ , μ΅κ³ μ‘°, κΌλκΈ°",
|
15 |
-
"maintenance": "μ μ§, μνλΉ, μ§μ",
|
16 |
-
"harbor": "νꡬ, νλ§",
|
17 |
-
"condition": "μν, 쑰건",
|
18 |
-
"storm": "νν, νν",
|
19 |
-
"edged": "λ μ΄ μλ, κ°μ₯μλ¦¬κ° μλ",
|
20 |
-
"decide": "κ²°μ νλ€",
|
21 |
-
"elderly": "μ°μΈκ° λμ , λμ΄κ° λ ",
|
22 |
-
"realize": "κΉ¨λ«λ€, μμ차리λ€, μΈμνλ€",
|
23 |
-
"modern": "νλμ μΈ",
|
24 |
-
"grave": "무λ€, λ¬",
|
25 |
-
"generation": "μΈλ",
|
26 |
-
"cheaper": "λ μΌ, λ μ λ ΄ν",
|
27 |
-
"technology": "κΈ°μ ",
|
28 |
-
"fail": "μ€ν¨νλ€",
|
29 |
-
"proving": "κ²μ¦νλ€, μ
μ¦νλ€",
|
30 |
-
"require": "μꡬνλ€, νμνλ€, μμ²νλ€",
|
31 |
-
"climb": "μ€λ₯΄λ€, λ±λ°νλ€",
|
32 |
-
"stood": "standμ κ³Όκ±° λΆμ¬, μλ€, μΌμ΄μλ€",
|
33 |
-
"council": "μν",
|
34 |
-
"position": "μμΉ, μ리, λ°°μΉνλ€",
|
35 |
-
"navigation": "νν΄, μ΄ν",
|
36 |
-
"operation": "μλ, κ°λ, μ‘°μ",
|
37 |
-
"happen": "(μ¬κ±΄ λ±μ΄) μΌμ΄λλ€",
|
38 |
-
"lighthouse": "λ±λ",
|
39 |
-
"lantern": "μμ λ±, λν΄",
|
40 |
-
"vast": "μ΄λ§μ΄λ§ν, λ°©λν, λ§λν",
|
41 |
-
"relief": "μλ, μλκ°",
|
42 |
-
"importance": "μ€μμ±",
|
43 |
-
"grandson": "μμ, μΈμμ",
|
44 |
-
"fierce": "μ¬λμ΄, κ²©λ ¬ν, κ·Ήμ¬ν",
|
45 |
-
"panic": "κ·Ήμ¬ν 곡ν¬, κ²μ μ§λ € μ΄μ© μ€ λͺ¨λ₯΄λ€",
|
46 |
-
"proposed": "μ μλ",
|
47 |
-
"mariner": "μ μ, λ±μ¬λ",
|
48 |
-
"ensure": "λ°λμ ~νκ² νλ€, 보μ₯νλ€",
|
49 |
-
"responsibly": "μ±
μκ° μκ²",
|
50 |
-
"flickering": "κΉλ°κ±°λ¦¬λ, κΊΌμ§ κ² κ°μ, μ½ν",
|
51 |
-
"cliff": "μ λ²½",
|
52 |
-
"humble": "κ²Έμν, κ²Έννκ² λ§λ€λ€",
|
53 |
-
"severe": "κ·Ήμ¬ν, κ°νΉν, μν",
|
54 |
-
"efficiency": "ν¨μ¨, ν¨μ¨ν",
|
55 |
-
"familiar": "μ΅μν",
|
56 |
-
"guiding": "μΈλνλ, μλ΄νλ",
|
57 |
-
"jagged": "μμμμν, λ€μ₯λ μ₯ν",
|
58 |
-
"decision": "κ²°μ , κ²°λ¨λ ₯",
|
59 |
-
"disastrous": "μ²μ°Έν, ννΈμλ",
|
60 |
-
"heartbroken": "λΉν΅ν΄ νλ, μ¬νμ μ κΈ΄, λΉνμ μ μ",
|
61 |
-
"wisdom": "μ§ν",
|
62 |
-
"solution": "ν΄κ²°μ±
",
|
63 |
-
"miraculously": "κΈ°μ μ μΌλ‘",
|
64 |
-
"rush": "κΈν μμ§μ΄λ€, νΌμ‘, μΉλ°μ΄ μ€λ₯΄λ€",
|
65 |
-
"brewed": "λͺ°μμΉλ€",
|
66 |
-
"reinstated": "볡μ§νλ€, 볡κ·νλ€",
|
67 |
-
"enduring": "μ€λκ°λ",
|
68 |
-
"winding": "ꡬλΆκ΅¬λΆν",
|
69 |
-
"unthinkable": "μμλ ν μ μλ"
|
70 |
-
}
|
71 |
-
|
72 |
-
# Import libraries
|
73 |
import gradio as gr
|
74 |
from gtts import gTTS
|
75 |
|
@@ -147,13 +75,13 @@ def translate_and_speak(word):
|
|
147 |
tts.save("translation.mp3")
|
148 |
return korean_translation, "translation.mp3"
|
149 |
|
150 |
-
# Create the Gradio interface
|
151 |
interface = gr.Interface(
|
152 |
fn=translate_and_speak,
|
153 |
-
inputs=gr.
|
154 |
outputs=[gr.Textbox(label="Korean Translation"), gr.Audio(label="Pronunciation")],
|
155 |
title="English to Korean Translator",
|
156 |
-
description="
|
157 |
)
|
158 |
|
159 |
# Launch the interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from gtts import gTTS
|
3 |
|
|
|
75 |
tts.save("translation.mp3")
|
76 |
return korean_translation, "translation.mp3"
|
77 |
|
78 |
+
# Create the Gradio interface with a dropdown
|
79 |
interface = gr.Interface(
|
80 |
fn=translate_and_speak,
|
81 |
+
inputs=gr.Dropdown(choices=list(translation_dict.keys()), label="Select an English word"),
|
82 |
outputs=[gr.Textbox(label="Korean Translation"), gr.Audio(label="Pronunciation")],
|
83 |
title="English to Korean Translator",
|
84 |
+
description="Select an English word to get its meaning in Korean and listen to the pronunciation."
|
85 |
)
|
86 |
|
87 |
# Launch the interface
|