Rong6693 commited on
Commit
702f42d
ยท
verified ยท
1 Parent(s): b345855

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +317 -0
app.py ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import random
3
+ from datetime import datetime
4
+
5
+ st.set_page_config(
6
+ page_title=โ€œSoulCompass - Find Your Inner North Starโ€,
7
+ page_icon=โ€œ๐Ÿงญโ€,
8
+ layout=โ€œwideโ€
9
+ )
10
+
11
+ # ๅˆๅง‹ๅŒ–
12
+
13
+ if โ€˜daily_usageโ€™ not in st.session_state:
14
+ st.session_state.daily_usage = 0
15
+
16
+ # ็ฐกๅŒ–ๅก”็พ…็‰Œ
17
+
18
+ tarot_cards = [
19
+ โ€œThe Fool - New beginnings and fresh startsโ€,
20
+ โ€œThe Magician - Power to manifest your dreamsโ€,
21
+ โ€œThe High Priestess - Trust your intuitionโ€,
22
+ โ€œThe Empress - Creativity and abundanceโ€,
23
+ โ€œThe Emperor - Structure and authorityโ€,
24
+ โ€œThe Lovers - Love and important choicesโ€,
25
+ โ€œThe Chariot - Victory through determinationโ€,
26
+ โ€œStrength - Inner courage and compassionโ€,
27
+ โ€œThe Hermit - Soul searching and wisdomโ€,
28
+ โ€œWheel of Fortune - Life cycles and destinyโ€,
29
+ โ€œJustice - Balance and fairnessโ€,
30
+ โ€œThe Hanged Man - New perspective neededโ€,
31
+ โ€œDeath - Transformation and renewalโ€,
32
+ โ€œTemperance - Patience and moderationโ€,
33
+ โ€œThe Devil - Breaking free from limitationsโ€,
34
+ โ€œThe Tower - Sudden change and awakeningโ€,
35
+ โ€œThe Star - Hope and inspirationโ€,
36
+ โ€œThe Moon - Dreams and subconsciousโ€,
37
+ โ€œThe Sun - Joy and successโ€,
38
+ โ€œJudgement - Spiritual awakeningโ€,
39
+ โ€œThe World - Completion and achievementโ€
40
+ ]
41
+
42
+ # CSS
43
+
44
+ st.markdown(โ€โ€โ€
45
+
46
+ <style>
47
+ .header {
48
+ text-align: center;
49
+ background: linear-gradient(135deg, #6366F1, #C084FC);
50
+ color: white;
51
+ padding: 3rem;
52
+ border-radius: 20px;
53
+ margin-bottom: 2rem;
54
+ }
55
+
56
+ .card {
57
+ background: linear-gradient(135deg, #1E3A8A, #6366F1);
58
+ color: white;
59
+ padding: 2rem;
60
+ border-radius: 15px;
61
+ margin: 1rem;
62
+ text-align: center;
63
+ border: 2px solid #F59E0B;
64
+ }
65
+
66
+ .result {
67
+ background: linear-gradient(135deg, #6366F1, #C084FC);
68
+ color: white;
69
+ padding: 2rem;
70
+ border-radius: 15px;
71
+ margin: 2rem 0;
72
+ }
73
+
74
+ .quota {
75
+ background: linear-gradient(135deg, #F59E0B, #FB923C);
76
+ color: white;
77
+ padding: 1rem 2rem;
78
+ border-radius: 50px;
79
+ text-align: center;
80
+ font-weight: bold;
81
+ margin: 2rem auto;
82
+ max-width: 400px;
83
+ }
84
+ </style>
85
+
86
+ โ€œโ€โ€, unsafe_allow_html=True)
87
+
88
+ # ไธปๆจ™้กŒ
89
+
90
+ st.markdown(โ€โ€โ€
91
+
92
+ <div class="header">
93
+ <h1>๐Ÿงญ SoulCompass</h1>
94
+ <h2>Find Your Inner North Star</h2>
95
+ <p>๐Ÿ”ฎ Tarot Reading | ๐Ÿ”ข Numerology | ๐Ÿ“– Soul Journal | ๐Ÿค– AI Therapist</p>
96
+ <div style="margin-top: 20px;">
97
+ <span style="background: rgba(255,255,255,0.2); padding: 8px 16px; border-radius: 20px; margin: 10px;">
98
+ โญ 15,247 users
99
+ </span>
100
+ <span style="background: rgba(255,255,255,0.2); padding: 8px 16px; border-radius: 20px; margin: 10px;">
101
+ ๐Ÿ’ฏ 4.9/5 rating
102
+ </span>
103
+ </div>
104
+ </div>
105
+ """, unsafe_allow_html=True)
106
+
107
+ # ๅ‰ฉ้ค˜ๆฌกๆ•ธ
108
+
109
+ remaining = 5 - st.session_state.daily_usage
110
+ st.markdown(fโ€โ€โ€
111
+
112
+ <div class="quota">
113
+ ๐ŸŽซ Daily Free Readings: {remaining}/5
114
+ </div>
115
+ """, unsafe_allow_html=True)
116
+
117
+ # ไธป่ฆๅŠŸ่ƒฝ
118
+
119
+ tab1, tab2, tab3, tab4 = st.tabs([โ€œ๐Ÿ”ฎ Tarot Readingโ€, โ€œ๐Ÿ”ข Numerologyโ€, โ€œ๐Ÿ“– Soul Journalโ€, โ€œ๐Ÿค– AI Therapistโ€])
120
+
121
+ with tab1:
122
+ st.header(โ€œ๐Ÿ”ฎ Tarot Readingโ€)
123
+ st.write(โ€*Let ancient wisdom guide your path*โ€)
124
+
125
+ ```
126
+ question = st.text_area(
127
+ "What would you like guidance on?",
128
+ placeholder="Example: I'm facing a difficult decision at work...",
129
+ height=100
130
+ )
131
+
132
+ if question:
133
+ spread = st.selectbox(
134
+ "Choose your reading type",
135
+ ["Single Card - Quick Guidance", "Three Cards - Past Present Future", "Five Cards - Deep Insight"]
136
+ )
137
+
138
+ if st.button("๐Ÿ”ฎ Draw Cards", type="primary"):
139
+ if st.session_state.daily_usage >= 5:
140
+ st.error("๐Ÿ˜” Daily limit reached! Come back tomorrow")
141
+ else:
142
+ st.session_state.daily_usage += 1
143
+
144
+ with st.spinner("โœจ Drawing your cards..."):
145
+ import time
146
+ time.sleep(2)
147
+
148
+ num_cards = 1 if "Single" in spread else (3 if "Three" in spread else 5)
149
+ drawn = random.sample(tarot_cards, num_cards)
150
+
151
+ st.success("๐ŸŒŸ Your reading is complete!")
152
+
153
+ # Show cards
154
+ for i, card in enumerate(drawn):
155
+ st.markdown(f"""
156
+ <div class="card">
157
+ <h3>Card {i+1}</h3>
158
+ <p>{card}</p>
159
+ </div>
160
+ """, unsafe_allow_html=True)
161
+
162
+ # Reading
163
+ reading = f"""
164
+ ```
165
+
166
+ ๐Ÿ”ฎ **Your SoulCompass Reading**
167
+
168
+ **Question:** {question}
169
+
170
+ **Cards Drawn:** {len(drawn)} cards
171
+
172
+ **Interpretation:**
173
+ The cards reveal important insights about your situation. The first card shows your current energy, while the others provide guidance for moving forward.
174
+
175
+ **Key Message:** Trust your inner wisdom and stay open to new possibilities. The universe is supporting your journey.
176
+
177
+ **Readings used today:** {st.session_state.daily_usage}/5
178
+ โ€œโ€โ€
179
+
180
+ ```
181
+ st.markdown(f"""
182
+ <div class="result">
183
+ {reading.replace(chr(10), '<br>')}
184
+ </div>
185
+ """, unsafe_allow_html=True)
186
+ ```
187
+
188
+ with tab2:
189
+ st.header(โ€œ๐Ÿ”ข Numerologyโ€)
190
+ st.write(โ€*Discover your numbers*โ€)
191
+
192
+ ```
193
+ col1, col2 = st.columns(2)
194
+
195
+ with col1:
196
+ st.subheader("Life Path Number")
197
+ birth_date = st.date_input("Your birth date")
198
+
199
+ if birth_date and st.button("Calculate"):
200
+ date_str = birth_date.strftime('%Y%m%d')
201
+ total = sum(int(d) for d in date_str)
202
+ while total > 9:
203
+ total = sum(int(d) for d in str(total))
204
+
205
+ meanings = {
206
+ 1: "Leader - Independent and pioneering",
207
+ 2: "Peacemaker - Cooperative and diplomatic",
208
+ 3: "Creative - Expressive and optimistic",
209
+ 4: "Builder - Practical and hardworking",
210
+ 5: "Explorer - Freedom-loving and adventurous",
211
+ 6: "Nurturer - Caring and responsible",
212
+ 7: "Seeker - Analytical and spiritual",
213
+ 8: "Achiever - Ambitious and organized",
214
+ 9: "Humanitarian - Compassionate and wise"
215
+ }
216
+
217
+ st.success(f"Your Life Path Number: **{total}**")
218
+ st.info(meanings.get(total, "Special number with unique meaning"))
219
+
220
+ with col2:
221
+ st.subheader("Name Number")
222
+ name = st.text_input("Your full name")
223
+
224
+ if name and st.button("Analyze Name"):
225
+ name_num = len(name) % 9 + 1
226
+ st.success(f"Your Name Number: **{name_num}**")
227
+ st.info("This number influences how others see you")
228
+ ```
229
+
230
+ with tab3:
231
+ st.header(โ€œ๐Ÿ“– Soul Journalโ€)
232
+ st.write(โ€*Record your inner journey*โ€)
233
+
234
+ ```
235
+ mood = st.slider("Today's mood (1-10)", 1, 10, 7)
236
+ emotion = st.selectbox("Main emotion", ["๐Ÿ˜Š Happy", "๐Ÿ˜” Sad", "๐Ÿ˜ฐ Worried", "๐Ÿ˜Œ Calm", "๐Ÿค— Grateful"])
237
+
238
+ entry = st.text_area(
239
+ "Write your thoughts",
240
+ placeholder="How are you feeling today? What's on your mind?",
241
+ height=120
242
+ )
243
+
244
+ if st.button("๐Ÿ’พ Save Entry"):
245
+ if entry:
246
+ st.success("โœ… Your journal entry has been saved!")
247
+ st.balloons()
248
+ else:
249
+ st.warning("Please write something first")
250
+ ```
251
+
252
+ with tab4:
253
+ st.header(โ€œ๐Ÿค– AI Therapistโ€)
254
+ st.write(โ€*Your 24/7 companion*โ€)
255
+
256
+ ```
257
+ st.markdown("""
258
+ <div style="background: #F3F4F6; padding: 20px; border-radius: 15px; margin: 20px 0;">
259
+ <div style="display: flex; align-items: center;">
260
+ <div style="font-size: 3rem; margin-right: 15px;">๐Ÿค–</div>
261
+ <div>
262
+ <h4 style="margin: 0; color: #6366F1;">SoulCompass AI Guide</h4>
263
+ <p style="margin: 5px 0; color: #6B7280;">Here to listen and support you</p>
264
+ </div>
265
+ </div>
266
+ </div>
267
+ """, unsafe_allow_html=True)
268
+
269
+ topic = st.selectbox(
270
+ "What would you like to talk about?",
271
+ ["General Support", "Stress & Anxiety", "Relationships", "Life Goals", "Personal Growth"]
272
+ )
273
+
274
+ message = st.text_area(
275
+ "Share your thoughts",
276
+ placeholder="Tell me what's on your mind...",
277
+ height=100
278
+ )
279
+
280
+ if message and st.button("๐Ÿ’ซ Get Support"):
281
+ with st.spinner("๐Ÿค– Thinking..."):
282
+ import time
283
+ time.sleep(1)
284
+
285
+ responses = [
286
+ f"Thank you for sharing about {topic.lower()}. I hear that you're saying: '{message}'. Your feelings are completely valid, and it's brave of you to reach out.",
287
+ f"I understand you're dealing with {topic.lower()}. What you've shared - '{message}' - shows real self-awareness. You're taking positive steps by talking about it.",
288
+ f"Regarding {topic.lower()}, I want you to know that '{message}' resonates with me. Remember, you have inner strength and wisdom to navigate this."
289
+ ]
290
+
291
+ response = random.choice(responses)
292
+
293
+ st.markdown(f"""
294
+ <div style="margin: 20px 0;">
295
+ <div style="background: #E5E7EB; padding: 15px; border-radius: 15px; margin-bottom: 10px;">
296
+ <strong>You:</strong> {message}
297
+ </div>
298
+ <div style="background: #6366F1; color: white; padding: 15px; border-radius: 15px;">
299
+ <strong>๐Ÿค– AI Guide:</strong> {response}
300
+ <br><br>
301
+ <small>๐Ÿ’™ I'm here to support you. For serious concerns, please reach out to a professional.</small>
302
+ </div>
303
+ </div>
304
+ """, unsafe_allow_html=True)
305
+ ```
306
+
307
+ # ้ ่…ณ
308
+
309
+ st.markdown(โ€โ€”โ€)
310
+ st.markdown(โ€โ€โ€
311
+
312
+ <div style="text-align: center; color: #6B7280; padding: 2rem;">
313
+ <p>๐Ÿงญ <strong>SoulCompass</strong> - Find Your Inner North Star</p>
314
+ <p>Made with โค๏ธ for spiritual seekers worldwide</p>
315
+ <p>๐Ÿ’Ž <a href="#" style="color: #6366F1;">Upgrade to Pro</a> | ๐Ÿ“ง [email protected] | ๐ŸŒ soulcompass.ai</p>
316
+ </div>
317
+ """, unsafe_allow_html=True)