xyemuz / app.py
openfree's picture
Upload app.py with huggingface_hub
fcaa525 verified
import gradio as gr
import random
from datetime import datetime
tarot_cards = {
"The Fool": "์ƒˆ๋กœ์šด ์‹œ์ž‘, ์ˆœ์ˆ˜ํ•จ, ๋ชจํ—˜",
"The Magician": "์ฐฝ์กฐ๋ ฅ, ์˜์ง€๋ ฅ, ์ˆ™๋ จ",
"The High Priestess": "์ง๊ด€, ์‹ ๋น„, ๋‚ด๋ฉด์˜ ์ง€ํ˜œ",
"The Empress": "ํ’์š”, ๋ชจ์„ฑ, ์ฐฝ์กฐ์„ฑ",
"The Emperor": "๊ถŒ์œ„, ๊ตฌ์กฐ, ์•ˆ์ •์„ฑ",
"The Hierophant": "์ „ํ†ต, ๊ต์œก, ์‹ ๋…",
"The Lovers": "์‚ฌ๋ž‘, ์กฐํ™”, ์„ ํƒ",
"The Chariot": "์˜์ง€, ์Šน๋ฆฌ, ์ž๊ธฐํ†ต์ œ",
"Strength": "์šฉ๊ธฐ, ์ธ๋‚ด, ๋‚ด๋ฉด์˜ ํž˜",
"The Hermit": "๋‚ด์ ์„ฑ์ฐฐ, ์ง€ํ˜œ, ๊ณ ๋…",
"Wheel of Fortune": "๋ณ€ํ™”, ์šด๋ช…, ๊ธฐํšŒ",
"Justice": "์ •์˜, ์ง„์‹ค, ๊ท ํ˜•",
"The Hanged Man": "ํฌ์ƒ, ์ƒˆ๋กœ์šด ๊ด€์ , ์ค‘๋‹จ",
"Death": "๋ณ€ํ™˜, ์ข…๋ฃŒ, ์ƒˆ๋กœ์šด ์‹œ์ž‘",
"Temperance": "์กฐํ™”, ๊ท ํ˜•, ์ ˆ์ œ",
"The Devil": "์†๋ฐ•, ๋ฌผ์งˆ์ฃผ์˜, ๊ทธ๋ฆผ์ž ์ž์•„",
"The Tower": "๊ธ‰๊ฒฉํ•œ ๋ณ€ํ™”, ํ˜ผ๋ˆ, ๊นจ๋‹ฌ์Œ",
"The Star": "ํฌ๋ง, ์˜๊ฐ, ํ‰์˜จ",
"The Moon": "์ง๊ด€, ํ™˜์ƒ, ๋ถˆํ™•์‹ค์„ฑ",
"The Sun": "๊ธฐ์จ, ์„ฑ๊ณต, ํ™œ๋ ฅ",
"Judgement": "์žฌ์ƒ, awakening, ๋‚ด์  ๋ถ€๋ฆ„",
"The World": "์™„์„ฑ, ํ†ตํ•ฉ, ์„ฑ์ทจ"
}
def get_reading(question, num_cards):
random.seed(datetime.now().timestamp())
selected_cards = random.sample(list(tarot_cards.items()), num_cards)
result = f"์งˆ๋ฌธ: {question}\n\n"
for i, (card, meaning) in enumerate(selected_cards, 1):
result += f"์นด๋“œ {i}: {card}\n"
result += f"์˜๋ฏธ: {meaning}\n\n"
return result
demo = gr.Interface(
fn=get_reading,
inputs=[
gr.Textbox(label="๋‹น์‹ ์˜ ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”", placeholder="์šด์„ธ๋‚˜ ๊ณ ๋ฏผ์„ ์ž…๋ ฅํ•˜์„ธ์š”..."),
gr.Slider(minimum=1, maximum=5, step=1, value=3, label="๋ฝ‘์„ ์นด๋“œ ์ˆ˜")
],
outputs=gr.Textbox(label="ํƒ€๋กœ ํ•ด์„", lines=10),
title="๐Ÿ”ฎ ํƒ€๋กœ ์นด๋“œ ๋ฆฌ๋”ฉ",
description="์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜๊ณ  ์นด๋“œ ์ˆ˜๋ฅผ ์„ ํƒํ•˜๋ฉด ํƒ€๋กœ ํ•ด์„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.",
theme="soft",
examples=[
["๋‚˜์˜ ํ˜„์žฌ ์ƒํ™ฉ์€ ์–ด๋–ค๊ฐ€์š”?", 3],
["์•ž์œผ๋กœ์˜ ์ง„๋กœ์— ๋Œ€ํ•ด ์กฐ์–ธํ•ด์ฃผ์„ธ์š”.", 5],
["์ง€๊ธˆ ๊ณ ๋ฏผํ•˜๋Š” ๊ฒฐ์ •์— ๋Œ€ํ•ด ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ๊นŒ์š”?", 1]
]
)
if __name__ == '__main__':
demo.launch()