openfree commited on
Commit
fcaa525
โ€ข
1 Parent(s): 10b8c3b

Upload app.py with huggingface_hub

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