Spaces:
Running
Running
Delete app.py
Browse files
app.py
DELETED
@@ -1,317 +0,0 @@
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|