Navya-Sree commited on
Commit
ed5692d
Β·
verified Β·
1 Parent(s): 1adaed5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +773 -0
app.py ADDED
@@ -0,0 +1,773 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+ import plotly.graph_objects as go
5
+ import plotly.express as px
6
+ from datetime import datetime
7
+ import json
8
+ import random
9
+ import re
10
+ from PIL import Image
11
+ import io
12
+ import base64
13
+
14
+ # Page configuration
15
+ st.set_page_config(
16
+ page_title="AI & Data Science Learning Platform",
17
+ page_icon="πŸ€–",
18
+ layout="wide",
19
+ initial_sidebar_state="expanded"
20
+ )
21
+
22
+ # Initialize session state
23
+ if 'user_progress' not in st.session_state:
24
+ st.session_state.user_progress = {
25
+ 'completed_lessons': [],
26
+ 'quiz_scores': {},
27
+ 'projects_completed': [],
28
+ 'skill_level': 'Beginner'
29
+ }
30
+
31
+ if 'current_quiz' not in st.session_state:
32
+ st.session_state.current_quiz = None
33
+
34
+ # Custom CSS
35
+ st.markdown("""
36
+ <style>
37
+ .main-header {
38
+ font-size: 3rem;
39
+ color: #1e3d59;
40
+ text-align: center;
41
+ margin-bottom: 2rem;
42
+ }
43
+ .sub-header {
44
+ font-size: 1.5rem;
45
+ color: #ff6e40;
46
+ margin-top: 1rem;
47
+ }
48
+ .info-box {
49
+ background-color: #f5f5f5;
50
+ padding: 1rem;
51
+ border-radius: 10px;
52
+ margin: 1rem 0;
53
+ }
54
+ .success-box {
55
+ background-color: #d4edda;
56
+ padding: 1rem;
57
+ border-radius: 10px;
58
+ margin: 1rem 0;
59
+ }
60
+ .warning-box {
61
+ background-color: #fff3cd;
62
+ padding: 1rem;
63
+ border-radius: 10px;
64
+ margin: 1rem 0;
65
+ }
66
+ </style>
67
+ """, unsafe_allow_html=True)
68
+
69
+ # Learning content database
70
+ LEARNING_MODULES = {
71
+ "Beginner": {
72
+ "Python Fundamentals": {
73
+ "topics": ["Variables & Data Types", "Control Flow", "Functions", "Data Structures"],
74
+ "duration": "2 weeks",
75
+ "projects": ["Calculator App", "To-Do List Manager"]
76
+ },
77
+ "Data Science Basics": {
78
+ "topics": ["NumPy", "Pandas", "Data Visualization", "Statistics"],
79
+ "duration": "3 weeks",
80
+ "projects": ["EDA on Titanic Dataset", "Sales Data Analysis"]
81
+ },
82
+ "Machine Learning Introduction": {
83
+ "topics": ["Supervised Learning", "Regression", "Classification", "Model Evaluation"],
84
+ "duration": "4 weeks",
85
+ "projects": ["House Price Prediction", "Iris Classification"]
86
+ }
87
+ },
88
+ "Intermediate": {
89
+ "Advanced ML": {
90
+ "topics": ["Ensemble Methods", "Feature Engineering", "Cross-Validation", "Hyperparameter Tuning"],
91
+ "duration": "4 weeks",
92
+ "projects": ["Customer Churn Prediction", "Credit Risk Assessment"]
93
+ },
94
+ "Deep Learning": {
95
+ "topics": ["Neural Networks", "CNNs", "RNNs", "Transfer Learning"],
96
+ "duration": "6 weeks",
97
+ "projects": ["Image Classification", "Text Sentiment Analysis"]
98
+ },
99
+ "NLP Fundamentals": {
100
+ "topics": ["Text Processing", "Word Embeddings", "Named Entity Recognition", "Topic Modeling"],
101
+ "duration": "4 weeks",
102
+ "projects": ["Spam Detection", "Document Clustering"]
103
+ }
104
+ },
105
+ "Advanced": {
106
+ "Advanced Deep Learning": {
107
+ "topics": ["GANs", "Autoencoders", "Transformers", "BERT/GPT"],
108
+ "duration": "8 weeks",
109
+ "projects": ["Image Generation", "Custom Chatbot"]
110
+ },
111
+ "MLOps": {
112
+ "topics": ["Model Deployment", "Docker", "CI/CD", "Model Monitoring"],
113
+ "duration": "4 weeks",
114
+ "projects": ["End-to-End ML Pipeline", "Model API Development"]
115
+ },
116
+ "Research & Innovation": {
117
+ "topics": ["Research Papers", "State-of-the-art Models", "Custom Architectures"],
118
+ "duration": "Ongoing",
119
+ "projects": ["Research Paper Implementation", "Novel Model Development"]
120
+ }
121
+ }
122
+ }
123
+
124
+ # Quiz questions database
125
+ QUIZ_DATABASE = {
126
+ "Python Fundamentals": [
127
+ {
128
+ "question": "What is the output of: print(type([1, 2, 3]))?",
129
+ "options": ["<class 'list'>", "<class 'tuple'>", "<class 'dict'>", "<class 'set'>"],
130
+ "correct": 0
131
+ },
132
+ {
133
+ "question": "Which method is used to add an element to a list?",
134
+ "options": ["add()", "append()", "insert_end()", "push()"],
135
+ "correct": 1
136
+ }
137
+ ],
138
+ "Machine Learning": [
139
+ {
140
+ "question": "Which metric is best for imbalanced classification?",
141
+ "options": ["Accuracy", "F1-Score", "MSE", "MAE"],
142
+ "correct": 1
143
+ },
144
+ {
145
+ "question": "What does overfitting mean?",
146
+ "options": [
147
+ "Model performs poorly on training data",
148
+ "Model performs well on training but poorly on test data",
149
+ "Model performs well on both training and test data",
150
+ "Model has too few parameters"
151
+ ],
152
+ "correct": 1
153
+ }
154
+ ]
155
+ }
156
+
157
+ # Job application templates
158
+ JOB_TEMPLATES = {
159
+ "Data Scientist": {
160
+ "skills": ["Python", "Machine Learning", "Statistics", "SQL", "Data Visualization"],
161
+ "keywords": ["predictive modeling", "statistical analysis", "A/B testing", "data pipeline"]
162
+ },
163
+ "ML Engineer": {
164
+ "skills": ["Python", "TensorFlow/PyTorch", "MLOps", "Docker", "Cloud Platforms"],
165
+ "keywords": ["model deployment", "scalability", "optimization", "production systems"]
166
+ },
167
+ "Data Analyst": {
168
+ "skills": ["SQL", "Excel", "Tableau/PowerBI", "Python/R", "Statistics"],
169
+ "keywords": ["data insights", "reporting", "dashboards", "business intelligence"]
170
+ }
171
+ }
172
+
173
+ def create_mind_map(topic, concepts):
174
+ """Create an interactive mind map visualization"""
175
+ fig = go.Figure()
176
+
177
+ # Center node
178
+ fig.add_trace(go.Scatter(
179
+ x=[0], y=[0],
180
+ mode='markers+text',
181
+ marker=dict(size=30, color='#ff6e40'),
182
+ text=[topic],
183
+ textposition="middle center",
184
+ textfont=dict(size=14, color='white'),
185
+ hoverinfo='text',
186
+ hovertext=topic
187
+ ))
188
+
189
+ # Concept nodes
190
+ n = len(concepts)
191
+ angles = np.linspace(0, 2*np.pi, n, endpoint=False)
192
+
193
+ for i, (concept, details) in enumerate(concepts.items()):
194
+ x = 2 * np.cos(angles[i])
195
+ y = 2 * np.sin(angles[i])
196
+
197
+ # Add edge
198
+ fig.add_trace(go.Scatter(
199
+ x=[0, x], y=[0, y],
200
+ mode='lines',
201
+ line=dict(color='#e0e0e0', width=2),
202
+ hoverinfo='none',
203
+ showlegend=False
204
+ ))
205
+
206
+ # Add concept node
207
+ fig.add_trace(go.Scatter(
208
+ x=[x], y=[y],
209
+ mode='markers+text',
210
+ marker=dict(size=25, color='#1e3d59'),
211
+ text=[concept],
212
+ textposition="top center",
213
+ textfont=dict(size=10),
214
+ hoverinfo='text',
215
+ hovertext=f"{concept}: {details}",
216
+ showlegend=False
217
+ ))
218
+
219
+ fig.update_layout(
220
+ showlegend=False,
221
+ height=400,
222
+ xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
223
+ yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
224
+ paper_bgcolor='white',
225
+ plot_bgcolor='white',
226
+ margin=dict(l=0, r=0, t=0, b=0)
227
+ )
228
+
229
+ return fig
230
+
231
+ def analyze_resume_ats(resume_text, job_role):
232
+ """Analyze resume for ATS compatibility"""
233
+ template = JOB_TEMPLATES.get(job_role, JOB_TEMPLATES["Data Scientist"])
234
+
235
+ # Check for keywords
236
+ found_skills = []
237
+ missing_skills = []
238
+
239
+ for skill in template["skills"]:
240
+ if skill.lower() in resume_text.lower():
241
+ found_skills.append(skill)
242
+ else:
243
+ missing_skills.append(skill)
244
+
245
+ # Check for action keywords
246
+ found_keywords = []
247
+ for keyword in template["keywords"]:
248
+ if keyword.lower() in resume_text.lower():
249
+ found_keywords.append(keyword)
250
+
251
+ # Calculate ATS score
252
+ skill_score = len(found_skills) / len(template["skills"]) * 50
253
+ keyword_score = min(len(found_keywords) / len(template["keywords"]) * 50, 50)
254
+ total_score = skill_score + keyword_score
255
+
256
+ return {
257
+ "score": total_score,
258
+ "found_skills": found_skills,
259
+ "missing_skills": missing_skills,
260
+ "found_keywords": found_keywords,
261
+ "recommendations": generate_recommendations(missing_skills, found_keywords, template["keywords"])
262
+ }
263
+
264
+ def generate_recommendations(missing_skills, found_keywords, all_keywords):
265
+ """Generate resume improvement recommendations"""
266
+ recommendations = []
267
+
268
+ if missing_skills:
269
+ recommendations.append(f"Add these skills to your resume: {', '.join(missing_skills[:3])}")
270
+
271
+ missing_keywords = [k for k in all_keywords if k not in found_keywords]
272
+ if missing_keywords:
273
+ recommendations.append(f"Include keywords like: {', '.join(missing_keywords[:3])}")
274
+
275
+ if len(found_keywords) < 2:
276
+ recommendations.append("Use more action verbs and industry-specific terminology")
277
+
278
+ recommendations.append("Quantify your achievements with numbers and percentages")
279
+ recommendations.append("Keep resume format simple and ATS-friendly (avoid complex formatting)")
280
+
281
+ return recommendations
282
+
283
+ def generate_quiz(topic, num_questions=5):
284
+ """Generate quiz questions for a topic"""
285
+ # For demo, using predefined questions or generating random ones
286
+ if topic in QUIZ_DATABASE:
287
+ return QUIZ_DATABASE[topic][:num_questions]
288
+ else:
289
+ # Generate generic questions
290
+ questions = []
291
+ for i in range(num_questions):
292
+ questions.append({
293
+ "question": f"Sample question {i+1} about {topic}?",
294
+ "options": ["Option A", "Option B", "Option C", "Option D"],
295
+ "correct": random.randint(0, 3)
296
+ })
297
+ return questions
298
+
299
+ def calculate_learning_path(current_level, target_role):
300
+ """Calculate personalized learning path"""
301
+ path = []
302
+
303
+ if current_level == "Beginner":
304
+ path.extend(["Python Fundamentals", "Data Science Basics", "Machine Learning Introduction"])
305
+ elif current_level == "Intermediate":
306
+ path.extend(["Advanced ML", "Deep Learning"])
307
+
308
+ # Add role-specific modules
309
+ if "Engineer" in target_role:
310
+ path.append("MLOps")
311
+ elif "Scientist" in target_role:
312
+ path.append("Advanced Statistics")
313
+ elif "Analyst" in target_role:
314
+ path.append("Business Intelligence")
315
+
316
+ return path
317
+
318
+ # Sidebar navigation
319
+ with st.sidebar:
320
+ st.markdown("## πŸŽ“ Learning Platform")
321
+
322
+ menu = st.selectbox(
323
+ "Navigation",
324
+ ["Dashboard", "Learn", "Practice", "Projects", "Quizzes",
325
+ "Career Guide", "Resume Builder", "Mind Maps", "Progress"]
326
+ )
327
+
328
+ st.markdown("---")
329
+
330
+ # User profile
331
+ st.markdown("### πŸ‘€ User Profile")
332
+ skill_level = st.selectbox("Skill Level", ["Beginner", "Intermediate", "Advanced"])
333
+ st.session_state.user_progress['skill_level'] = skill_level
334
+
335
+ target_role = st.selectbox(
336
+ "Target Role",
337
+ ["Data Scientist", "ML Engineer", "Data Analyst", "AI Researcher"]
338
+ )
339
+
340
+ st.markdown("---")
341
+ st.markdown("### πŸ“Š Quick Stats")
342
+ st.metric("Completed Lessons", len(st.session_state.user_progress['completed_lessons']))
343
+ st.metric("Projects Done", len(st.session_state.user_progress['projects_completed']))
344
+
345
+ avg_score = np.mean(list(st.session_state.user_progress['quiz_scores'].values())) if st.session_state.user_progress['quiz_scores'] else 0
346
+ st.metric("Avg Quiz Score", f"{avg_score:.1f}%")
347
+
348
+ # Main content area
349
+ if menu == "Dashboard":
350
+ st.markdown("<h1 class='main-header'>πŸš€ AI & Data Science Learning Platform</h1>", unsafe_allow_html=True)
351
+
352
+ col1, col2, col3 = st.columns(3)
353
+
354
+ with col1:
355
+ st.markdown("### πŸ“š Learning Modules")
356
+ modules_count = sum(len(modules) for modules in LEARNING_MODULES.values())
357
+ st.metric("Total Modules", modules_count)
358
+ st.markdown("Comprehensive curriculum from basics to advanced")
359
+
360
+ with col2:
361
+ st.markdown("### 🎯 Projects")
362
+ projects_count = sum(
363
+ len(module_info.get("projects", []))
364
+ for level_modules in LEARNING_MODULES.values()
365
+ for module_info in level_modules.values()
366
+ )
367
+ st.metric("Hands-on Projects", projects_count)
368
+ st.markdown("Real-world projects to build your portfolio")
369
+
370
+ with col3:
371
+ st.markdown("### πŸ’Ό Career Support")
372
+ st.metric("Job Roles Covered", len(JOB_TEMPLATES))
373
+ st.markdown("Resume optimization and interview prep")
374
+
375
+ # Learning path recommendation
376
+ st.markdown("---")
377
+ st.markdown("### πŸ—ΊοΈ Your Personalized Learning Path")
378
+
379
+ learning_path = calculate_learning_path(skill_level, target_role)
380
+
381
+ progress_cols = st.columns(len(learning_path))
382
+ for i, module in enumerate(learning_path):
383
+ with progress_cols[i]:
384
+ if module in st.session_state.user_progress['completed_lessons']:
385
+ st.success(f"βœ… {module}")
386
+ else:
387
+ st.info(f"πŸ“˜ {module}")
388
+
389
+ # Recent achievements
390
+ st.markdown("---")
391
+ st.markdown("### πŸ† Recent Achievements")
392
+
393
+ if st.session_state.user_progress['completed_lessons']:
394
+ for lesson in st.session_state.user_progress['completed_lessons'][-3:]:
395
+ st.markdown(f"- Completed: **{lesson}**")
396
+ else:
397
+ st.markdown("Start learning to earn achievements!")
398
+
399
+ elif menu == "Learn":
400
+ st.markdown("<h1 class='main-header'>πŸ“š Learning Modules</h1>", unsafe_allow_html=True)
401
+
402
+ selected_level = st.selectbox("Select Level", ["Beginner", "Intermediate", "Advanced"])
403
+
404
+ modules = LEARNING_MODULES[selected_level]
405
+
406
+ for module_name, module_info in modules.items():
407
+ with st.expander(f"πŸ“˜ {module_name} - {module_info['duration']}"):
408
+ st.markdown("**Topics Covered:**")
409
+ for topic in module_info['topics']:
410
+ st.markdown(f"- {topic}")
411
+
412
+ st.markdown("**Projects:**")
413
+ for project in module_info['projects']:
414
+ st.markdown(f"- πŸ› οΈ {project}")
415
+
416
+ col1, col2 = st.columns(2)
417
+ with col1:
418
+ if st.button(f"Start Learning", key=f"learn_{module_name}"):
419
+ st.session_state.user_progress['completed_lessons'].append(module_name)
420
+ st.success(f"Started learning {module_name}!")
421
+
422
+ with col2:
423
+ if st.button(f"View Resources", key=f"resources_{module_name}"):
424
+ st.info("Resources: Documentation, Videos, Articles, Code Examples")
425
+
426
+ elif menu == "Practice":
427
+ st.markdown("<h1 class='main-header'>πŸ’» Practice Coding</h1>", unsafe_allow_html=True)
428
+
429
+ practice_type = st.selectbox(
430
+ "Select Practice Type",
431
+ ["Python Basics", "Data Manipulation", "Machine Learning", "Deep Learning", "SQL"]
432
+ )
433
+
434
+ st.markdown("### πŸ“ Coding Challenge")
435
+
436
+ challenges = {
437
+ "Python Basics": {
438
+ "title": "List Comprehension",
439
+ "problem": "Create a list of squares for numbers 1 to 10 using list comprehension",
440
+ "hint": "Use [x**2 for x in range(1, 11)]"
441
+ },
442
+ "Data Manipulation": {
443
+ "title": "Pandas DataFrame Operations",
444
+ "problem": "Filter a DataFrame to show only rows where 'age' > 25 and 'salary' > 50000",
445
+ "hint": "Use df[(df['age'] > 25) & (df['salary'] > 50000)]"
446
+ },
447
+ "Machine Learning": {
448
+ "title": "Train-Test Split",
449
+ "problem": "Split your data into 80% training and 20% testing sets",
450
+ "hint": "Use train_test_split from sklearn.model_selection"
451
+ }
452
+ }
453
+
454
+ if practice_type in challenges:
455
+ challenge = challenges[practice_type]
456
+ st.markdown(f"**Challenge:** {challenge['title']}")
457
+ st.markdown(f"**Problem:** {challenge['problem']}")
458
+
459
+ code_input = st.text_area("Write your code here:", height=200)
460
+
461
+ col1, col2 = st.columns(2)
462
+ with col1:
463
+ if st.button("Run Code"):
464
+ st.success("Code executed successfully! (Simulation)")
465
+ st.code("Output: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]")
466
+
467
+ with col2:
468
+ if st.button("Show Hint"):
469
+ st.info(f"Hint: {challenge['hint']}")
470
+
471
+ elif menu == "Projects":
472
+ st.markdown("<h1 class='main-header'>πŸ› οΈ Hands-on Projects</h1>", unsafe_allow_html=True)
473
+
474
+ project_category = st.selectbox(
475
+ "Select Project Category",
476
+ ["Beginner Projects", "Intermediate Projects", "Advanced Projects", "Portfolio Projects"]
477
+ )
478
+
479
+ projects = {
480
+ "Beginner Projects": [
481
+ {
482
+ "name": "Titanic Survival Prediction",
483
+ "description": "Predict passenger survival using logistic regression",
484
+ "skills": ["Pandas", "Scikit-learn", "Data Visualization"],
485
+ "difficulty": "⭐⭐"
486
+ },
487
+ {
488
+ "name": "Stock Price Analysis",
489
+ "description": "Analyze and visualize stock market trends",
490
+ "skills": ["Pandas", "Matplotlib", "Time Series"],
491
+ "difficulty": "⭐⭐"
492
+ }
493
+ ],
494
+ "Intermediate Projects": [
495
+ {
496
+ "name": "Customer Segmentation",
497
+ "description": "Segment customers using clustering algorithms",
498
+ "skills": ["K-Means", "PCA", "Feature Engineering"],
499
+ "difficulty": "⭐⭐⭐"
500
+ },
501
+ {
502
+ "name": "Sentiment Analysis",
503
+ "description": "Analyze sentiment from product reviews",
504
+ "skills": ["NLP", "NLTK", "Classification"],
505
+ "difficulty": "⭐⭐⭐"
506
+ }
507
+ ]
508
+ }
509
+
510
+ if project_category in projects:
511
+ for project in projects[project_category]:
512
+ with st.expander(f"πŸ“ {project['name']} - {project['difficulty']}"):
513
+ st.markdown(f"**Description:** {project['description']}")
514
+ st.markdown("**Skills you'll learn:**")
515
+ for skill in project['skills']:
516
+ st.markdown(f"- {skill}")
517
+
518
+ col1, col2, col3 = st.columns(3)
519
+ with col1:
520
+ if st.button(f"Start Project", key=f"start_{project['name']}"):
521
+ st.session_state.user_progress['projects_completed'].append(project['name'])
522
+ st.success("Project started!")
523
+
524
+ with col2:
525
+ if st.button(f"View Solution", key=f"solution_{project['name']}"):
526
+ st.code("""
527
+ # Sample solution structure
528
+ import pandas as pd
529
+ from sklearn.model_selection import train_test_split
530
+ from sklearn.linear_model import LogisticRegression
531
+
532
+ # Load data
533
+ data = pd.read_csv('data.csv')
534
+
535
+ # Preprocessing
536
+ # ... your code here
537
+
538
+ # Model training
539
+ model = LogisticRegression()
540
+ model.fit(X_train, y_train)
541
+
542
+ # Evaluation
543
+ accuracy = model.score(X_test, y_test)
544
+ print(f'Accuracy: {accuracy}')
545
+ """)
546
+
547
+ with col3:
548
+ if st.button(f"Download Dataset", key=f"data_{project['name']}"):
549
+ st.info("Dataset downloaded! (Simulation)")
550
+
551
+ elif menu == "Quizzes":
552
+ st.markdown("<h1 class='main-header'>πŸ“ Knowledge Assessment</h1>", unsafe_allow_html=True)
553
+
554
+ quiz_topic = st.selectbox(
555
+ "Select Quiz Topic",
556
+ ["Python Fundamentals", "Machine Learning", "Deep Learning", "Statistics", "SQL"]
557
+ )
558
+
559
+ if st.button("Start Quiz"):
560
+ st.session_state.current_quiz = generate_quiz(quiz_topic, 5)
561
+ st.session_state.quiz_answers = {}
562
+
563
+ if st.session_state.current_quiz:
564
+ st.markdown(f"### Quiz: {quiz_topic}")
565
+
566
+ for i, q in enumerate(st.session_state.current_quiz):
567
+ st.markdown(f"**Question {i+1}:** {q['question']}")
568
+ answer = st.radio(
569
+ "Select your answer:",
570
+ q['options'],
571
+ key=f"q_{i}"
572
+ )
573
+ st.session_state.quiz_answers[i] = q['options'].index(answer) if answer else None
574
+
575
+ if st.button("Submit Quiz"):
576
+ score = 0
577
+ for i, q in enumerate(st.session_state.current_quiz):
578
+ if st.session_state.quiz_answers.get(i) == q['correct']:
579
+ score += 1
580
+
581
+ percentage = (score / len(st.session_state.current_quiz)) * 100
582
+ st.session_state.user_progress['quiz_scores'][quiz_topic] = percentage
583
+
584
+ if percentage >= 80:
585
+ st.success(f"Excellent! You scored {percentage:.0f}%")
586
+ elif percentage >= 60:
587
+ st.warning(f"Good job! You scored {percentage:.0f}%")
588
+ else:
589
+ st.error(f"Keep practicing! You scored {percentage:.0f}%")
590
+
591
+ # Show correct answers
592
+ st.markdown("### Correct Answers:")
593
+ for i, q in enumerate(st.session_state.current_quiz):
594
+ st.markdown(f"Q{i+1}: {q['options'][q['correct']]}")
595
+
596
+ elif menu == "Career Guide":
597
+ st.markdown("<h1 class='main-header'>πŸ’Ό Career Guidance</h1>", unsafe_allow_html=True)
598
+
599
+ tab1, tab2, tab3 = st.tabs(["Career Paths", "Skills Roadmap", "Interview Prep"])
600
+
601
+ with tab1:
602
+ st.markdown("### 🎯 AI/Data Science Career Paths")
603
+
604
+ careers = {
605
+ "Data Scientist": {
606
+ "salary": "$120,000 - $180,000",
607
+ "skills": "Python, ML, Statistics, Communication",
608
+ "description": "Analyze complex data to help companies make decisions"
609
+ },
610
+ "ML Engineer": {
611
+ "salary": "$130,000 - $200,000",
612
+ "skills": "Python, MLOps, Cloud, Software Engineering",
613
+ "description": "Build and deploy ML models at scale"
614
+ },
615
+ "Data Analyst": {
616
+ "salary": "$70,000 - $110,000",
617
+ "skills": "SQL, Excel, Visualization, Business Acumen",
618
+ "description": "Transform data into actionable insights"
619
+ },
620
+ "AI Research Scientist": {
621
+ "salary": "$150,000 - $300,000",
622
+ "skills": "Deep Learning, Research, Mathematics, Publishing",
623
+ "description": "Push the boundaries of AI technology"
624
+ }
625
+ }
626
+
627
+ for role, info in careers.items():
628
+ with st.expander(f"πŸ‘” {role}"):
629
+ st.markdown(f"**Salary Range:** {info['salary']}")
630
+ st.markdown(f"**Key Skills:** {info['skills']}")
631
+ st.markdown(f"**Description:** {info['description']}")
632
+
633
+ if st.button(f"View Learning Path", key=f"path_{role}"):
634
+ path = calculate_learning_path(skill_level, role)
635
+ st.markdown("**Recommended Learning Path:**")
636
+ for i, module in enumerate(path, 1):
637
+ st.markdown(f"{i}. {module}")
638
+
639
+ with tab2:
640
+ st.markdown("### πŸ—ΊοΈ Skills Roadmap")
641
+
642
+ skill_timeline = {
643
+ "Month 1-2": ["Python Basics", "Git/GitHub", "SQL Fundamentals"],
644
+ "Month 3-4": ["Data Analysis", "Statistics", "Visualization"],
645
+ "Month 5-6": ["Machine Learning", "Feature Engineering", "Model Evaluation"],
646
+ "Month 7-9": ["Deep Learning", "NLP/Computer Vision", "Cloud Platforms"],
647
+ "Month 10-12": ["MLOps", "Production Systems", "Advanced Topics"]
648
+ }
649
+
650
+ for period, skills in skill_timeline.items():
651
+ st.markdown(f"**{period}:**")
652
+ for skill in skills:
653
+ st.markdown(f"- {skill}")
654
+
655
+ with tab3:
656
+ st.markdown("### 🎀 Interview Preparation")
657
+
658
+ interview_topics = {
659
+ "Technical Questions": [
660
+ "Explain the bias-variance tradeoff",
661
+ "What is gradient descent?",
662
+ "Difference between L1 and L2 regularization",
663
+ "How do you handle imbalanced datasets?"
664
+ ],
665
+ "Behavioral Questions": [
666
+ "Tell me about a challenging project",
667
+ "How do you handle conflicting priorities?",
668
+ "Describe a time you worked with stakeholders",
669
+ "How do you stay updated with AI trends?"
670
+ ],
671
+ "Case Studies": [
672
+ "Design a recommendation system",
673
+ "Predict customer churn",
674
+ "Detect fraudulent transactions",
675
+ "Optimize marketing campaigns"
676
+ ]
677
+ }
678
+
679
+ for category, questions in interview_topics.items():
680
+ with st.expander(f"πŸ“š {category}"):
681
+ for q in questions:
682
+ st.markdown(f"β€’ {q}")
683
+
684
+ if st.button(f"Practice {category}", key=f"practice_{category}"):
685
+ st.info("Practice session started! Prepare your answers and time yourself.")
686
+
687
+ elif menu == "Resume Builder":
688
+ st.markdown("<h1 class='main-header'>πŸ“„ ATS-Optimized Resume Builder</h1>", unsafe_allow_html=True)
689
+
690
+ tab1, tab2, tab3 = st.tabs(["Resume Analysis", "LinkedIn Optimizer", "Cover Letter"])
691
+
692
+ with tab1:
693
+ st.markdown("### πŸ” ATS Resume Analyzer")
694
+
695
+ job_role = st.selectbox(
696
+ "Select Target Role",
697
+ list(JOB_TEMPLATES.keys())
698
+ )
699
+
700
+ resume_text = st.text_area(
701
+ "Paste your resume text here:",
702
+ height=300,
703
+ placeholder="Copy and paste your entire resume content..."
704
+ )
705
+
706
+ if st.button("Analyze Resume"):
707
+ if resume_text:
708
+ analysis = analyze_resume_ats(resume_text, job_role)
709
+
710
+ # Display ATS Score
711
+ col1, col2 = st.columns(2)
712
+ with col1:
713
+ score_color = "green" if analysis['score'] >= 80 else "orange" if analysis['score'] >= 60 else "red"
714
+ st.markdown(f"### ATS Score: <span style='color:{score_color}'>{analysis['score']:.0f}%</span>", unsafe_allow_html=True)
715
+
716
+ with col2:
717
+ st.metric("Skills Match", f"{len(analysis['found_skills'])}/{len(JOB_TEMPLATES[job_role]['skills'])}")
718
+
719
+ # Found skills
720
+ if analysis['found_skills']:
721
+ st.success("βœ… **Skills Found:**")
722
+ st.write(", ".join(analysis['found_skills']))
723
+
724
+ # Missing skills
725
+ if analysis['missing_skills']:
726
+ st.warning("⚠️ **Missing Skills:**")
727
+ st.write(", ".join(analysis['missing_skills']))
728
+
729
+ # Recommendations
730
+ st.markdown("### πŸ’‘ Recommendations:")
731
+ for rec in analysis['recommendations']:
732
+ st.markdown(f"β€’ {rec}")
733
+ else:
734
+ st.error("Please paste your resume text")
735
+
736
+ with tab2:
737
+ st.markdown("### πŸ”— LinkedIn Profile Optimizer")
738
+
739
+ linkedin_sections = {
740
+ "Headline": "Data Scientist | Machine Learning | Python | Transforming Data into Insights",
741
+ "Summary": "Passionate data scientist with 3+ years of experience in building ML models that drive business value. Skilled in Python, TensorFlow, and cloud deployment.",
742
+ "Skills": ["Python", "Machine Learning", "Deep Learning", "SQL", "TensorFlow", "PyTorch", "AWS", "Docker"]
743
+ }
744
+
745
+ for section, content in linkedin_sections.items():
746
+ st.markdown(f"**{section} Template:**")
747
+ if isinstance(content, list):
748
+ st.write(", ".join(content))
749
+ else:
750
+ st.write(content)
751
+
752
+ st.markdown("### 🎯 LinkedIn Tips:")
753
+ tips = [
754
+ "Use keywords from job descriptions in your headline and summary",
755
+ "Add 50+ skills and get endorsements for top skills",
756
+ "Write detailed descriptions for each role with quantified achievements",
757
+ "Add relevant certifications and courses",
758
+ "Engage with content in your field regularly"
759
+ ]
760
+
761
+ for tip in tips:
762
+ st.markdown(f"β€’ {tip}")
763
+
764
+ with tab3:
765
+ st.markdown("### βœ‰οΈ Cover Letter Generator")
766
+
767
+ company_name = st.text_input("Company Name")
768
+ position = st.text_input("Position")
769
+
770
+ if st.button("Generate Cover Letter Template"):
771
+ if company_name and position:
772
+ cover_letter = f"""
773
+ Dear Hiring Manager at {company_name