Spaces:
Running
Running
File size: 8,346 Bytes
674911f |
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 |
import streamlit as st
import google.generativeai as genai
from datetime import datetime
import os
from dotenv import load_dotenv
# Initialize Gemini
load_dotenv()
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
# Learning paths focused on modern skills
LEARNING_PATHS = {
"π° Money Queen": {
"emoji": "π°",
"color": "#98FB98",
"description": "Master your money! From budgeting to investing, get that bag! π
",
"modules": [
{
"title": "Budget Like a Boss",
"topics": ["Personal budgeting", "Saving strategies", "Money mindset"],
"prompt": "You're teaching teen girls about {topic}. Use Gen Z language, be encouraging, and give practical examples they can relate to."
},
{
"title": "Investing 101",
"topics": ["Stock market basics", "Investment apps", "Long-term planning"],
"prompt": "Explain {topic} to teen girls using Gen Z language. Make investing concepts fun and relatable."
},
{
"title": "Side Hustle Era",
"topics": ["Online business ideas", "Digital marketing", "Pricing strategies"],
"prompt": "Share practical advice about {topic} for teen entrepreneurs. Use trendy language and real examples."
}
]
},
"π€ AI & Tech Bestie": {
"emoji": "π€",
"color": "#FFB6C1",
"description": "Slay the AI game! Learn to use AI tools like a pro! β¨",
"modules": [
{
"title": "AI Tools Mastery",
"topics": ["Gemini basics", "ChatGPT tips", "Prompt writing"],
"prompt": "Teach teen girls how to use {topic}. Include practical examples and creative ways to use AI tools."
},
{
"title": "Content Creation",
"topics": ["AI writing tools", "Image generation", "Video editing AI"],
"prompt": "Explain how to use {topic} for content creation. Include trendy examples and creative ideas."
},
{
"title": "AI Business Ideas",
"topics": ["AI services", "Online tutoring", "Digital products"],
"prompt": "Share ideas for {topic} that teen girls can start. Make it practical and achievable."
}
]
},
"π Business Queen": {
"emoji": "π",
"color": "#DDA0DD",
"description": "Build your empire! Learn business & marketing secrets! π«",
"modules": [
{
"title": "Business Basics",
"topics": ["Business planning", "Market research", "Branding"],
"prompt": "Explain {topic} in Gen Z language. Use examples relevant to teen entrepreneurs."
},
{
"title": "Social Media Empire",
"topics": ["Content strategy", "Growth hacks", "Monetization"],
"prompt": "Share practical tips for {topic}. Include trending platforms and strategies."
},
{
"title": "Customer Queen",
"topics": ["Customer service", "Community building", "Brand loyalty"],
"prompt": "Teach about {topic} using relatable examples for teen business owners."
}
]
}
}
def get_ai_lesson(path, module, topic):
"""Get personalized lesson from Gemini"""
try:
prompt = f"{LEARNING_PATHS[path]['modules'][module]['prompt'].format(topic=topic)}\n\nProvide a fun, interactive lesson with:\n1. Key points\n2. Real examples\n3. Action steps\n4. Pro tips"
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(prompt)
return response.text
except Exception as e:
return "Oops! Let's try that lesson again bestie! π"
def create_practice_task(path, module, topic):
"""Generate practice task using Gemini"""
try:
prompt = f"""Create a practical task for teen girls learning about {topic}.
Make it:
1. Fun and engaging
2. Actually doable
3. Related to real life
4. Something they can complete in 15-30 minutes
Use Gen Z language and emojis!"""
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content(prompt)
return response.text
except Exception as e:
return "Let's try another task bestie! π"
def show_page():
st.markdown("""
<h1 style='text-align: center;'>β¨ She Glows β¨</h1>
<p style='text-align: center;'>Level up your skills & secure that bag! π
</p>
""", unsafe_allow_html=True)
# Initialize session state
if 'current_path' not in st.session_state:
st.session_state.current_path = None
if 'progress' not in st.session_state:
st.session_state.progress = {}
if 'achievements' not in st.session_state:
st.session_state.achievements = []
# Create columns
col1, col2 = st.columns([1, 2])
with col1:
st.markdown("### Choose Your Glow Up β¨")
# Path selection buttons
for path, info in LEARNING_PATHS.items():
if st.button(
f"{info['emoji']} {path}",
key=f"path_{path}",
use_container_width=True
):
st.session_state.current_path = path
st.rerun()
# Show achievements
if st.session_state.achievements:
st.markdown("### Your Achievements π")
for achievement in st.session_state.achievements:
st.markdown(f"- {achievement['emoji']} {achievement['title']}")
with col2:
if st.session_state.current_path:
path = st.session_state.current_path
path_info = LEARNING_PATHS[path]
# Display path info
st.markdown(f"""
<div style='background-color: {path_info['color']}30;
padding: 20px; border-radius: 15px; margin-bottom: 20px;'>
<h3>{path_info['emoji']} {path}</h3>
<p>{path_info['description']}</p>
</div>
""", unsafe_allow_html=True)
# Show modules
st.markdown("### Your Modules π")
for i, module in enumerate(path_info['modules']):
with st.expander(f"{module['title']} β¨"):
# Topics in module
for topic in module['topics']:
st.markdown(f"#### {topic}")
# Get lesson
if st.button(f"Learn about {topic} π", key=f"learn_{topic}"):
lesson = get_ai_lesson(path, i, topic)
st.markdown(lesson)
# Practice task
st.markdown("### Practice Time! πͺ")
task = create_practice_task(path, i, topic)
st.info(task)
# Complete button
if st.button("I've completed this! β
", key=f"complete_{topic}"):
# Add achievement
achievement = {
'title': f"Mastered {topic}",
'emoji': "π",
'date': datetime.now().strftime("%B %d, %Y")
}
st.session_state.achievements.append(achievement)
st.balloons()
st.success("Yass queen! Keep slaying! π")
st.rerun()
else:
st.markdown("""
### Welcome to Your Glow Up Journey! β¨
Choose your path to start:
- π° Money Queen: Master your finances
- π€ AI & Tech Bestie: Learn AI tools
- π Business Queen: Start your empire
Let's level up together! π
""") |