Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -83,18 +83,85 @@ init_index_long, init_text_long, init_image_long, init_audio_long = 0, long_vowe
|
|
83 |
|
84 |
# π Gradio UI ꡬμ±
|
85 |
with gr.Blocks(title="π κ·μ¬μ΄ μ€ν 리 μ±") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
with gr.Tabs():
|
87 |
with gr.TabItem("Short Vowel (λ¨λͺ¨μ)"):
|
88 |
state_index_short = gr.State(value=init_index_short)
|
89 |
state_text_short = gr.State(value=init_text_short)
|
90 |
|
91 |
-
story_text_short = gr.Markdown(value=init_text_short)
|
92 |
-
story_image_short = gr.Image(value=init_image_short
|
93 |
audio_output_short = gr.Audio(value=init_audio_short, autoplay=True)
|
94 |
|
95 |
with gr.Row():
|
96 |
-
next_button_short = gr.Button("π λ€μ μ΄μΌκΈ°")
|
97 |
-
play_button_short = gr.Button("π λ€μ λ£κΈ°")
|
98 |
|
99 |
next_button_short.click(
|
100 |
fn=next_story,
|
@@ -112,13 +179,13 @@ with gr.Blocks(title="π κ·μ¬μ΄ μ€ν 리 μ±") as demo:
|
|
112 |
state_index_long = gr.State(value=init_index_long)
|
113 |
state_text_long = gr.State(value=init_text_long)
|
114 |
|
115 |
-
story_text_long = gr.Markdown(value=init_text_long)
|
116 |
-
story_image_long = gr.Image(value=init_image_long
|
117 |
audio_output_long = gr.Audio(value=init_audio_long, autoplay=False)
|
118 |
|
119 |
with gr.Row():
|
120 |
-
next_button_long = gr.Button("π λ€μ μ΄μΌκΈ°")
|
121 |
-
play_button_long = gr.Button("π λ€μ λ£κΈ°")
|
122 |
|
123 |
next_button_long.click(
|
124 |
fn=next_story,
|
@@ -132,6 +199,5 @@ with gr.Blocks(title="π κ·μ¬μ΄ μ€ν 리 μ±") as demo:
|
|
132 |
outputs=[audio_output_long]
|
133 |
)
|
134 |
|
135 |
-
|
136 |
# π μ± μ€ν
|
137 |
demo.launch()
|
|
|
83 |
|
84 |
# π Gradio UI ꡬμ±
|
85 |
with gr.Blocks(title="π κ·μ¬μ΄ μ€ν 리 μ±") as demo:
|
86 |
+
gr.HTML("""
|
87 |
+
<style>
|
88 |
+
body {
|
89 |
+
background-color: #FFFAF0; /* λ°λ»ν ν¬λ¦Όμ λ°°κ²½ */
|
90 |
+
font-family: 'Comic Sans MS', cursive, sans-serif;
|
91 |
+
}
|
92 |
+
|
93 |
+
h1 {
|
94 |
+
color: #FF6347;
|
95 |
+
text-align: center;
|
96 |
+
font-size: 3em;
|
97 |
+
font-weight: bold;
|
98 |
+
margin-top: 20px;
|
99 |
+
}
|
100 |
+
|
101 |
+
p {
|
102 |
+
text-align: center;
|
103 |
+
font-size: 1.2em;
|
104 |
+
color: #6B4226;
|
105 |
+
}
|
106 |
+
|
107 |
+
.story-text {
|
108 |
+
font-size: 4em;
|
109 |
+
font-weight: bold;
|
110 |
+
text-align: center;
|
111 |
+
color: #FF4500;
|
112 |
+
padding: 20px;
|
113 |
+
border-radius: 15px;
|
114 |
+
background: #FFF3E0;
|
115 |
+
display: inline-block;
|
116 |
+
box-shadow: 4px 4px 10px rgba(0,0,0,0.2);
|
117 |
+
}
|
118 |
+
|
119 |
+
.btn-custom {
|
120 |
+
font-size: 1.5em;
|
121 |
+
font-weight: bold;
|
122 |
+
border-radius: 20px;
|
123 |
+
padding: 10px 20px;
|
124 |
+
margin: 5px;
|
125 |
+
border: none;
|
126 |
+
cursor: pointer;
|
127 |
+
box-shadow: 3px 3px 8px rgba(0,0,0,0.2);
|
128 |
+
}
|
129 |
+
|
130 |
+
.next-btn {
|
131 |
+
background-color: #FFD700; /* λ
Έλμ λ²νΌ */
|
132 |
+
}
|
133 |
+
|
134 |
+
.play-btn {
|
135 |
+
background-color: #90EE90; /* μ°ν μ΄λ‘μ λ²νΌ */
|
136 |
+
}
|
137 |
+
|
138 |
+
img {
|
139 |
+
border-radius: 15px;
|
140 |
+
border: 5px solid #FFFFFF;
|
141 |
+
box-shadow: 4px 4px 10px rgba(0,0,0,0.2);
|
142 |
+
width: 400px;
|
143 |
+
height: 400px;
|
144 |
+
display: block;
|
145 |
+
margin: auto;
|
146 |
+
}
|
147 |
+
</style>
|
148 |
+
""")
|
149 |
+
|
150 |
+
gr.HTML("<h1>π μ¬λ―Έμλ μμ΄ μ€ν 리 νμ! π</h1>")
|
151 |
+
gr.HTML("<p>π± κ·μ¬μ΄ μ΄μΌκΈ°μ ν¨κ» μμ΄λ₯Ό λ°°μ보μμ! <br> λ²νΌμ λλ¬ λ€μ μ΄μΌκΈ°λ‘ λμ΄κ°κ³ , μμ±μ λ€μΌλ©° λ°λΌ μ½μ΄λ³΄μΈμ! π΅</p>")
|
152 |
+
|
153 |
with gr.Tabs():
|
154 |
with gr.TabItem("Short Vowel (λ¨λͺ¨μ)"):
|
155 |
state_index_short = gr.State(value=init_index_short)
|
156 |
state_text_short = gr.State(value=init_text_short)
|
157 |
|
158 |
+
story_text_short = gr.Markdown(value=f"<div class='story-text'>{init_text_short}</div>")
|
159 |
+
story_image_short = gr.Image(value=init_image_short)
|
160 |
audio_output_short = gr.Audio(value=init_audio_short, autoplay=True)
|
161 |
|
162 |
with gr.Row():
|
163 |
+
next_button_short = gr.Button("π λ€μ μ΄μΌκΈ°", elem_classes=["btn-custom", "next-btn"])
|
164 |
+
play_button_short = gr.Button("π λ€μ λ£κΈ°", elem_classes=["btn-custom", "play-btn"])
|
165 |
|
166 |
next_button_short.click(
|
167 |
fn=next_story,
|
|
|
179 |
state_index_long = gr.State(value=init_index_long)
|
180 |
state_text_long = gr.State(value=init_text_long)
|
181 |
|
182 |
+
story_text_long = gr.Markdown(value=f"<div class='story-text'>{init_text_long}</div>")
|
183 |
+
story_image_long = gr.Image(value=init_image_long)
|
184 |
audio_output_long = gr.Audio(value=init_audio_long, autoplay=False)
|
185 |
|
186 |
with gr.Row():
|
187 |
+
next_button_long = gr.Button("π λ€μ μ΄μΌκΈ°", elem_classes=["btn-custom", "next-btn"])
|
188 |
+
play_button_long = gr.Button("π λ€μ λ£κΈ°", elem_classes=["btn-custom", "play-btn"])
|
189 |
|
190 |
next_button_long.click(
|
191 |
fn=next_story,
|
|
|
199 |
outputs=[audio_output_long]
|
200 |
)
|
201 |
|
|
|
202 |
# π μ± μ€ν
|
203 |
demo.launch()
|