Upload app.py with huggingface_hub
Browse files
app.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import random
|
3 |
+
from datetime import datetime
|
4 |
+
tarot_cards = {
|
5 |
+
"The Fool": "์๋ก์ด ์์, ์์ํจ, ๋ชจํ",
|
6 |
+
"The Magician": "์ฐฝ์กฐ๋ ฅ, ์์ง๋ ฅ, ์๋ จ",
|
7 |
+
"The High Priestess": "์ง๊ด, ์ ๋น, ๋ด๋ฉด์ ์งํ",
|
8 |
+
"The Empress": "ํ์, ๋ชจ์ฑ, ์ฐฝ์กฐ์ฑ",
|
9 |
+
"The Emperor": "๊ถ์, ๊ตฌ์กฐ, ์์ ์ฑ",
|
10 |
+
"The Hierophant": "์ ํต, ๊ต์ก, ์ ๋
",
|
11 |
+
"The Lovers": "์ฌ๋, ์กฐํ, ์ ํ",
|
12 |
+
"The Chariot": "์์ง, ์น๋ฆฌ, ์๊ธฐํต์ ",
|
13 |
+
"Strength": "์ฉ๊ธฐ, ์ธ๋ด, ๋ด๋ฉด์ ํ",
|
14 |
+
"The Hermit": "๋ด์ ์ฑ์ฐฐ, ์งํ, ๊ณ ๋
",
|
15 |
+
"Wheel of Fortune": "๋ณํ, ์ด๋ช
, ๊ธฐํ",
|
16 |
+
"Justice": "์ ์, ์ง์ค, ๊ท ํ",
|
17 |
+
"The Hanged Man": "ํฌ์, ์๋ก์ด ๊ด์ , ์ค๋จ",
|
18 |
+
"Death": "๋ณํ, ์ข
๋ฃ, ์๋ก์ด ์์",
|
19 |
+
"Temperance": "์กฐํ, ๊ท ํ, ์ ์ ",
|
20 |
+
"The Devil": "์๋ฐ, ๋ฌผ์ง์ฃผ์, ๊ทธ๋ฆผ์ ์์",
|
21 |
+
"The Tower": "๊ธ๊ฒฉํ ๋ณํ, ํผ๋, ๊นจ๋ฌ์",
|
22 |
+
"The Star": "ํฌ๋ง, ์๊ฐ, ํ์จ",
|
23 |
+
"The Moon": "์ง๊ด, ํ์, ๋ถํ์ค์ฑ",
|
24 |
+
"The Sun": "๊ธฐ์จ, ์ฑ๊ณต, ํ๋ ฅ",
|
25 |
+
"Judgement": "์ฌ์, awakening, ๋ด์ ๋ถ๋ฆ",
|
26 |
+
"The World": "์์ฑ, ํตํฉ, ์ฑ์ทจ"
|
27 |
+
}
|
28 |
+
def get_reading(question, num_cards):
|
29 |
+
random.seed(datetime.now().timestamp())
|
30 |
+
selected_cards = random.sample(list(tarot_cards.items()), num_cards)
|
31 |
+
result = f"์ง๋ฌธ: {question}\n\n"
|
32 |
+
for i, (card, meaning) in enumerate(selected_cards, 1):
|
33 |
+
result += f"์นด๋ {i}: {card}\n"
|
34 |
+
result += f"์๋ฏธ: {meaning}\n\n"
|
35 |
+
return result
|
36 |
+
demo = gr.Interface(
|
37 |
+
fn=get_reading,
|
38 |
+
inputs=[
|
39 |
+
gr.Textbox(label="๋น์ ์ ์ง๋ฌธ์ ์
๋ ฅํ์ธ์", placeholder="์ด์ธ๋ ๊ณ ๋ฏผ์ ์
๋ ฅํ์ธ์..."),
|
40 |
+
gr.Slider(minimum=1, maximum=5, step=1, value=3, label="๋ฝ์ ์นด๋ ์")
|
41 |
+
],
|
42 |
+
outputs=gr.Textbox(label="ํ๋ก ํด์", lines=10),
|
43 |
+
title="๐ฎ ํ๋ก ์นด๋ ๋ฆฌ๋ฉ",
|
44 |
+
description="์ง๋ฌธ์ ์
๋ ฅํ๊ณ ์นด๋ ์๋ฅผ ์ ํํ๋ฉด ํ๋ก ํด์์ ์ ๊ณตํฉ๋๋ค.",
|
45 |
+
theme="soft",
|
46 |
+
examples=[
|
47 |
+
["๋์ ํ์ฌ ์ํฉ์ ์ด๋ค๊ฐ์?", 3],
|
48 |
+
["์์ผ๋ก์ ์ง๋ก์ ๋ํด ์กฐ์ธํด์ฃผ์ธ์.", 5],
|
49 |
+
["์ง๊ธ ๊ณ ๋ฏผํ๋ ๊ฒฐ์ ์ ๋ํด ์ด๋ป๊ฒ ํด์ผํ ๊น์?", 1]
|
50 |
+
]
|
51 |
+
)
|
52 |
+
|
53 |
+
if __name__ == '__main__':
|
54 |
+
demo.launch()
|