Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def show_prayer_and_music(prayer_selection, music_selection):
|
4 |
+
prayers = {
|
5 |
+
"보νμ κΈ°λ": "μ£Όλμ 보νλ‘ λλ₯Ό μ»μ΄μ£Όμκ³ , 보νΈν΄μ£Όμμ.",
|
6 |
+
"μλ
λ₯Ό μν κΈ°λ": "μ¬λνλ μλ
λ€μ΄ μ£Όλμ μΆλ³΅ μμμ μλΌλκ² νμμ.",
|
7 |
+
"μΉμ κΈ°λ": "μ£Όλμ μκΈΈλ‘ λ΄ λͺΈκ³Ό λ§μμ μΉμ ν΄μ£Όμμ."
|
8 |
+
}
|
9 |
+
|
10 |
+
music_urls = {
|
11 |
+
"μμ
1": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
|
12 |
+
"μμ
2": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3",
|
13 |
+
"μμ
3": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3"
|
14 |
+
}
|
15 |
+
|
16 |
+
prayer_text = prayers.get(prayer_selection, "μ νλ κΈ°λκ° μμ΅λλ€.")
|
17 |
+
music_url = music_urls.get(music_selection, "")
|
18 |
+
|
19 |
+
html_code = f"""
|
20 |
+
<audio id="background-music" controls autoplay loop>
|
21 |
+
<source src="{music_url}" type="audio/mpeg">
|
22 |
+
Your browser does not support the audio element.
|
23 |
+
</audio>
|
24 |
+
<style>
|
25 |
+
body {{
|
26 |
+
background-color: #f5f5dc; /* μ°ν λ² μ΄μ§μ */
|
27 |
+
}}
|
28 |
+
</style>
|
29 |
+
"""
|
30 |
+
|
31 |
+
return prayer_text, html_code
|
32 |
+
|
33 |
+
prayer_options = ["보νμ κΈ°λ", "μλ
λ₯Ό μν κΈ°λ", "μΉμ κΈ°λ"]
|
34 |
+
music_options = ["μμ
1", "μμ
2", "μμ
3"]
|
35 |
+
|
36 |
+
prayer_dropdown = gr.Dropdown(choices=prayer_options, label="κΈ°λλ¬Έ μ ν")
|
37 |
+
music_dropdown = gr.Dropdown(choices=music_options, label="λ°°κ²½μμ
μ ν")
|
38 |
+
output_text = gr.Textbox(label="κΈ°λλ¬Έ")
|
39 |
+
output_html = gr.HTML(label="λ°°κ²½μμ
")
|
40 |
+
|
41 |
+
interface = gr.Interface(
|
42 |
+
fn=show_prayer_and_music,
|
43 |
+
inputs=[prayer_dropdown, music_dropdown],
|
44 |
+
outputs=[output_text, output_html],
|
45 |
+
live=True
|
46 |
+
)
|
47 |
+
|
48 |
+
interface.launch()
|