Soulcompass / app.py
Rong6693's picture
Update app.py
60a9c1e verified
raw
history blame
10.1 kB
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"])
# ๐Ÿ”ฎ Tarot
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!")
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 = 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)
# ๐Ÿ”ข Numerology
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")
# ๐Ÿ“– Soul Journal
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")
# ๐Ÿค– AI Therapist
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)