englissi commited on
Commit
f05b1b1
Β·
verified Β·
1 Parent(s): fa97a5b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -0
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()