prayer / app.py
englissi's picture
Create app.py
f05b1b1 verified
raw
history blame
1.74 kB
import gradio as gr
def show_prayer_and_music(prayer_selection, music_selection):
prayers = {
"보혈의 기도": "μ£Όλ‹˜μ˜ 보혈둜 λ‚˜λ₯Ό μ”»μ–΄μ£Όμ‹œκ³ , λ³΄ν˜Έν•΄μ£Όμ†Œμ„œ.",
"μžλ…€λ₯Ό μœ„ν•œ 기도": "μ‚¬λž‘ν•˜λŠ” μžλ…€λ“€μ΄ μ£Όλ‹˜μ˜ 좕볡 μ†μ—μ„œ μžλΌλ‚˜κ²Œ ν•˜μ†Œμ„œ.",
"μΉ˜μœ κΈ°λ„": "μ£Όλ‹˜μ˜ μ†κΈΈλ‘œ λ‚΄ λͺΈκ³Ό λ§ˆμŒμ„ μΉ˜μœ ν•΄μ£Όμ†Œμ„œ."
}
music_urls = {
"μŒμ•… 1": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3",
"μŒμ•… 2": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-2.mp3",
"μŒμ•… 3": "https://www.soundhelix.com/examples/mp3/SoundHelix-Song-3.mp3"
}
prayer_text = prayers.get(prayer_selection, "μ„ νƒλœ 기도가 μ—†μŠ΅λ‹ˆλ‹€.")
music_url = music_urls.get(music_selection, "")
html_code = f"""
<audio id="background-music" controls autoplay loop>
<source src="{music_url}" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<style>
body {{
background-color: #f5f5dc; /* μ—°ν•œ 베이지색 */
}}
</style>
"""
return prayer_text, html_code
prayer_options = ["보혈의 기도", "μžλ…€λ₯Ό μœ„ν•œ 기도", "μΉ˜μœ κΈ°λ„"]
music_options = ["μŒμ•… 1", "μŒμ•… 2", "μŒμ•… 3"]
prayer_dropdown = gr.Dropdown(choices=prayer_options, label="기도문 선택")
music_dropdown = gr.Dropdown(choices=music_options, label="λ°°κ²½μŒμ•… 선택")
output_text = gr.Textbox(label="기도문")
output_html = gr.HTML(label="λ°°κ²½μŒμ•…")
interface = gr.Interface(
fn=show_prayer_and_music,
inputs=[prayer_dropdown, music_dropdown],
outputs=[output_text, output_html],
live=True
)
interface.launch()