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