|
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() |