Spaces:
Sleeping
Sleeping
File size: 44,671 Bytes
62bb808 ed5692d bfa9fdf 62bb808 ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf 9af805a bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf 9af805a ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf ed5692d bfa9fdf 9af805a bfa9fdf 9af805a bfa9fdf 9af805a bfa9fdf ed5692d bfa9fdf |
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 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 |
# app.py
import streamlit as st
import pandas as pd
import numpy as np
import plotly.graph_objects as go
import plotly.express as px
from datetime import datetime
import json
import random
import re
from PIL import Image
import io
import base64
import textwrap
import time
import os
# Page configuration
st.set_page_config(
page_title="AI & Data Science Learning Platform",
page_icon="π€",
layout="wide",
initial_sidebar_state="expanded"
)
# Initialize session state
if 'user_progress' not in st.session_state:
st.session_state.user_progress = {
'completed_lessons': [],
'quiz_scores': {},
'projects_completed': [],
'skill_level': 'Beginner',
'job_applications': [],
'mind_maps': {}
}
if 'current_quiz' not in st.session_state:
st.session_state.current_quiz = None
# Custom CSS
st.markdown("""
<style>
.main-header {
font-size: 3rem;
color: #1e3d59;
text-align: center;
margin-bottom: 2rem;
}
.sub-header {
font-size: 1.5rem;
color: #ff6e40;
margin-top: 1rem;
}
.info-box {
background-color: #f5f5f5;
padding: 1rem;
border-radius: 10px;
margin: 1rem 0;
}
.success-box {
background-color: #d4edda;
padding: 1rem;
border-radius: 10px;
margin: 1rem 0;
}
.warning-box {
background-color: #fff3cd;
padding: 1rem;
border-radius: 10px;
margin: 1rem 0;
}
.project-card {
border: 1px solid #e0e0e0;
border-radius: 10px;
padding: 1.5rem;
margin: 1rem 0;
transition: transform 0.3s;
}
.project-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.mind-map-container {
background-color: #f9f9f9;
border-radius: 10px;
padding: 1.5rem;
margin: 1rem 0;
}
</style>
""", unsafe_allow_html=True)
# Learning content database
LEARNING_MODULES = {
"Beginner": {
"Python Fundamentals": {
"topics": {
"Variables & Data Types": "Understanding basic data types and variables in Python",
"Control Flow": "Conditional statements and loops",
"Functions": "Creating and using functions",
"Data Structures": "Lists, tuples, dictionaries, sets"
},
"duration": "2 weeks",
"projects": ["Calculator App", "To-Do List Manager"],
"resources": ["Python Documentation", "Interactive Tutorial"]
},
"Data Science Basics": {
"topics": {
"NumPy": "Numerical computing with arrays",
"Pandas": "Data manipulation and analysis",
"Data Visualization": "Creating plots with Matplotlib and Seaborn",
"Statistics": "Descriptive and inferential statistics"
},
"duration": "3 weeks",
"projects": ["EDA on Titanic Dataset", "Sales Data Analysis"],
"resources": ["Pandas Cheat Sheet", "Visualization Gallery"]
},
"Machine Learning Introduction": {
"topics": {
"Supervised Learning": "Regression and classification",
"Model Evaluation": "Metrics and validation techniques",
"Feature Engineering": "Preprocessing and transformation",
"Scikit-learn": "Implementing ML algorithms"
},
"duration": "4 weeks",
"projects": ["House Price Prediction", "Iris Classification"],
"resources": ["Scikit-learn Documentation", "ML Tutorials"]
}
},
"Intermediate": {
"Advanced ML": {
"topics": {
"Ensemble Methods": "Random Forests, Gradient Boosting",
"Hyperparameter Tuning": "Grid search and random search",
"Dimensionality Reduction": "PCA, t-SNE",
"Model Deployment": "Basic deployment techniques"
},
"duration": "4 weeks",
"projects": ["Customer Churn Prediction", "Credit Risk Assessment"],
"resources": ["Advanced ML Techniques", "Deployment Guide"]
},
"Deep Learning": {
"topics": {
"Neural Networks": "Perceptrons and activation functions",
"CNNs": "Image classification",
"RNNs": "Sequence modeling",
"Transfer Learning": "Using pre-trained models"
},
"duration": "6 weeks",
"projects": ["Image Classification", "Text Sentiment Analysis"],
"resources": ["TensorFlow Tutorials", "PyTorch Examples"]
},
"NLP Fundamentals": {
"topics": {
"Text Processing": "Tokenization, stemming, lemmatization",
"Word Embeddings": "Word2Vec, GloVe",
"Named Entity Recognition": "Identifying entities in text",
"Topic Modeling": "LDA and NMF"
},
"duration": "4 weeks",
"projects": ["Spam Detection", "Document Clustering"],
"resources": ["NLP with Python", "Transformers Guide"]
}
},
"Advanced": {
"Advanced Deep Learning": {
"topics": {
"GANs": "Generative Adversarial Networks",
"Autoencoders": "Dimensionality reduction and generation",
"Transformers": "Attention mechanisms",
"BERT/GPT": "State-of-the-art language models"
},
"duration": "8 weeks",
"projects": ["Image Generation", "Custom Chatbot"],
"resources": ["Research Papers", "Advanced Implementations"]
},
"MLOps": {
"topics": {
"Model Deployment": "Docker and Kubernetes",
"CI/CD": "Continuous integration and deployment",
"Monitoring": "Model performance tracking",
"Scaling": "Distributed training"
},
"duration": "4 weeks",
"projects": ["End-to-End ML Pipeline", "Model API Development"],
"resources": ["MLOps Best Practices", "Cloud Platforms Guide"]
},
"Research & Innovation": {
"topics": {
"Research Papers": "Reading and implementing papers",
"State-of-the-art Models": "Cutting-edge architectures",
"Custom Architectures": "Designing novel models",
"Experimentation": "Designing and running experiments"
},
"duration": "Ongoing",
"projects": ["Research Paper Implementation", "Novel Model Development"],
"resources": ["Academic Journals", "Conference Proceedings"]
}
}
}
# Quiz questions database
QUIZ_DATABASE = {
"Python Fundamentals": [
{
"question": "What is the output of: print(type([1, 2, 3]))?",
"options": ["<class 'list'>", "<class 'tuple'>", "<class 'dict'>", "<class 'set'>"],
"correct": 0,
"explanation": "In Python, square brackets [] denote a list."
},
{
"question": "Which method is used to add an element to a list?",
"options": ["add()", "append()", "insert_end()", "push()"],
"correct": 1,
"explanation": "The append() method adds an element to the end of a list."
}
],
"Machine Learning": [
{
"question": "Which metric is best for imbalanced classification?",
"options": ["Accuracy", "F1-Score", "MSE", "MAE"],
"correct": 1,
"explanation": "F1-Score considers both precision and recall, making it suitable for imbalanced datasets."
},
{
"question": "What does overfitting mean?",
"options": [
"Model performs poorly on training data",
"Model performs well on training but poorly on test data",
"Model performs well on both training and test data",
"Model has too few parameters"
],
"correct": 1,
"explanation": "Overfitting occurs when a model learns the training data too well, including noise, and fails to generalize to new data."
}
]
}
# Job application templates
JOB_TEMPLATES = {
"Data Scientist": {
"skills": ["Python", "Machine Learning", "Statistics", "SQL", "Data Visualization"],
"keywords": ["predictive modeling", "statistical analysis", "A/B testing", "data pipeline"],
"description": "Analyze complex data to help companies make decisions"
},
"ML Engineer": {
"skills": ["Python", "TensorFlow/PyTorch", "MLOps", "Docker", "Cloud Platforms"],
"keywords": ["model deployment", "scalability", "optimization", "production systems"],
"description": "Build and deploy ML models at scale"
},
"Data Analyst": {
"skills": ["SQL", "Excel", "Tableau/PowerBI", "Python/R", "Statistics"],
"keywords": ["data insights", "reporting", "dashboards", "business intelligence"],
"description": "Transform data into actionable insights"
}
}
# Mind map database
MIND_MAP_DB = {
"Machine Learning": {
"Supervised Learning": "Learning from labeled data",
"Unsupervised Learning": "Finding patterns in unlabeled data",
"Reinforcement Learning": "Learning through rewards and penalties",
"Deep Learning": "Neural networks with multiple layers"
},
"Data Science Process": {
"Data Collection": "Gathering raw data",
"Data Cleaning": "Handling missing values and outliers",
"Exploratory Analysis": "Understanding data patterns",
"Model Building": "Creating predictive models",
"Deployment": "Putting models into production"
}
}
def create_mind_map(topic, concepts):
"""Create an interactive mind map visualization"""
fig = go.Figure()
# Center node
fig.add_trace(go.Scatter(
x=[0], y=[0],
mode='markers+text',
marker=dict(size=50, color='#ff6e40'),
text=[topic],
textposition="middle center",
textfont=dict(size=18, color='white', family="Arial Black"),
hoverinfo='text',
hovertext=topic
))
# Concept nodes
n = len(concepts)
angles = np.linspace(0, 2*np.pi, n, endpoint=False)
for i, (concept, details) in enumerate(concepts.items()):
x = 2 * np.cos(angles[i])
y = 2 * np.sin(angles[i])
# Add edge
fig.add_trace(go.Scatter(
x=[0, x], y=[0, y],
mode='lines',
line=dict(color='#1e3d59', width=2),
hoverinfo='none',
showlegend=False
))
# Add concept node
fig.add_trace(go.Scatter(
x=[x], y=[y],
mode='markers+text',
marker=dict(size=35, color='#1e3d59'),
text=[concept],
textposition="top center",
textfont=dict(size=12, color='white'),
hoverinfo='text',
hovertext=f"<b>{concept}</b><br>{details}",
showlegend=False
))
fig.update_layout(
showlegend=False,
height=500,
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
paper_bgcolor='white',
plot_bgcolor='white',
margin=dict(l=0, r=0, t=0, b=0),
hoverlabel=dict(
bgcolor="white",
font_size=14,
font_family="Arial"
)
)
return fig
def analyze_resume_ats(resume_text, job_role):
"""Analyze resume for ATS compatibility"""
template = JOB_TEMPLATES.get(job_role, JOB_TEMPLATES["Data Scientist"])
# Check for keywords
found_skills = []
missing_skills = []
for skill in template["skills"]:
if re.search(rf'\b{re.escape(skill)}\b', resume_text, re.IGNORECASE):
found_skills.append(skill)
else:
missing_skills.append(skill)
# Check for action keywords
found_keywords = []
for keyword in template["keywords"]:
if re.search(rf'\b{re.escape(keyword)}\b', resume_text, re.IGNORECASE):
found_keywords.append(keyword)
# Calculate ATS score
skill_score = len(found_skills) / len(template["skills"]) * 50
keyword_score = min(len(found_keywords) / len(template["keywords"]) * 50, 50)
total_score = skill_score + keyword_score
return {
"score": total_score,
"found_skills": found_skills,
"missing_skills": missing_skills,
"found_keywords": found_keywords,
"recommendations": generate_recommendations(missing_skills, found_keywords, template["keywords"])
}
def generate_recommendations(missing_skills, found_keywords, all_keywords):
"""Generate resume improvement recommendations"""
recommendations = []
if missing_skills:
recommendations.append(f"Add these skills to your resume: {', '.join(missing_skills[:3])}")
missing_keywords = [k for k in all_keywords if k not in found_keywords]
if missing_keywords:
recommendations.append(f"Include keywords like: {', '.join(missing_keywords[:3])}")
if len(found_keywords) < 2:
recommendations.append("Use more action verbs and industry-specific terminology")
recommendations.append("Quantify your achievements with numbers and percentages")
recommendations.append("Keep resume format simple and ATS-friendly (avoid complex formatting)")
recommendations.append("Include relevant certifications and projects")
recommendations.append("Tailor your resume for each job application")
return recommendations
def generate_quiz(topic, num_questions=5):
"""Generate quiz questions for a topic"""
# For demo, using predefined questions or generating random ones
if topic in QUIZ_DATABASE:
return QUIZ_DATABASE[topic][:num_questions]
else:
# Generate generic questions
questions = []
for i in range(num_questions):
questions.append({
"question": f"Sample question {i+1} about {topic}?",
"options": ["Option A", "Option B", "Option C", "Option D"],
"correct": random.randint(0, 3),
"explanation": f"This is an explanation for question {i+1}"
})
return questions
def calculate_learning_path(current_level, target_role):
"""Calculate personalized learning path"""
path = []
if current_level == "Beginner":
path.extend(["Python Fundamentals", "Data Science Basics", "Machine Learning Introduction"])
elif current_level == "Intermediate":
path.extend(["Advanced ML", "Deep Learning"])
# Add role-specific modules
if "Engineer" in target_role:
path.append("MLOps")
elif "Scientist" in target_role:
path.append("Advanced Statistics")
elif "Analyst" in target_role:
path.append("Business Intelligence")
return path
def generate_cover_letter(company_name, position, user_skills):
"""Generate personalized cover letter"""
return f"""
Dear Hiring Manager at {company_name},
I am writing to express my interest in the {position} position at {company_name}.
With my background in {', '.join(user_skills[:3])} and passion for data-driven solutions,
I am confident in my ability to contribute effectively to your team.
In my previous experience, I have successfully:
- Developed machine learning models that improved accuracy by 25%
- Implemented data pipelines processing 1M+ records daily
- Created interactive dashboards that informed key business decisions
I am particularly drawn to {company_name} because of your innovative approach to
AI solutions and your commitment to [specific company value or project].
My attached resume provides further detail about my qualifications.
I would welcome the opportunity to discuss how my skills and experiences
align with the needs of your team.
Thank you for your time and consideration.
Sincerely,
[Your Name]
[Your Contact Information]
"""
# Sidebar navigation
with st.sidebar:
st.markdown("## π AI Learning Platform")
menu = st.selectbox(
"Navigation",
["Dashboard", "Learn", "Practice", "Projects", "Quizzes",
"Career Guide", "Resume Builder", "Mind Maps", "Progress"]
)
st.markdown("---")
# User profile
st.markdown("### π€ User Profile")
skill_level = st.selectbox("Skill Level", ["Beginner", "Intermediate", "Advanced"])
st.session_state.user_progress['skill_level'] = skill_level
target_role = st.selectbox(
"Target Role",
["Data Scientist", "ML Engineer", "Data Analyst", "AI Researcher"]
)
st.markdown("---")
st.markdown("### π Quick Stats")
st.metric("Completed Lessons", len(st.session_state.user_progress['completed_lessons']))
st.metric("Projects Done", len(st.session_state.user_progress['projects_completed']))
avg_score = np.mean(list(st.session_state.user_progress['quiz_scores'].values())) if st.session_state.user_progress['quiz_scores'] else 0
st.metric("Avg Quiz Score", f"{avg_score:.1f}%")
st.markdown("---")
st.markdown("### π Quick Actions")
if st.button("New Learning Session"):
st.session_state.user_progress['completed_lessons'].append("New Session")
st.success("Started new learning session!")
if st.button("Generate Practice Exercise"):
st.info("Generated new practice exercise!")
# Main content area
if menu == "Dashboard":
st.markdown("<h1 class='main-header'>π AI & Data Science Learning Platform</h1>", unsafe_allow_html=True)
col1, col2, col3 = st.columns(3)
with col1:
st.markdown("### π Learning Modules")
modules_count = sum(len(modules) for modules in LEARNING_MODULES.values())
st.metric("Total Modules", modules_count)
st.markdown("Comprehensive curriculum from basics to advanced")
with col2:
st.markdown("### π― Projects")
projects_count = sum(
len(module_info.get("projects", []))
for level_modules in LEARNING_MODULES.values()
for module_info in level_modules.values()
)
st.metric("Hands-on Projects", projects_count)
st.markdown("Real-world projects to build your portfolio")
with col3:
st.markdown("### πΌ Career Support")
st.metric("Job Roles Covered", len(JOB_TEMPLATES))
st.markdown("Resume optimization and interview prep")
# Learning path recommendation
st.markdown("---")
st.markdown("### πΊοΈ Your Personalized Learning Path")
learning_path = calculate_learning_path(skill_level, target_role)
progress_cols = st.columns(len(learning_path))
for i, module in enumerate(learning_path):
with progress_cols[i]:
if module in st.session_state.user_progress['completed_lessons']:
st.success(f"β
{module}")
else:
st.info(f"π {module}")
# Recent achievements
st.markdown("---")
st.markdown("### π Recent Achievements")
if st.session_state.user_progress['completed_lessons']:
for lesson in st.session_state.user_progress['completed_lessons'][-3:]:
st.markdown(f"- Completed: **{lesson}**")
else:
st.markdown("Start learning to earn achievements!")
# Recommended next steps
st.markdown("---")
st.markdown("### π£ Your Next Steps")
st.markdown("1. Start with Python Fundamentals in the Learn section")
st.markdown("2. Practice coding challenges in the Practice section")
st.markdown("3. Build your first project: Titanic Survival Prediction")
elif menu == "Learn":
st.markdown("<h1 class='main-header'>π Learning Modules</h1>", unsafe_allow_html=True)
selected_level = st.selectbox("Select Level", ["Beginner", "Intermediate", "Advanced"])
modules = LEARNING_MODULES[selected_level]
for module_name, module_info in modules.items():
with st.expander(f"π {module_name} - {module_info['duration']}"):
st.markdown("**Topics Covered:**")
for topic, description in module_info['topics'].items():
st.markdown(f"#### {topic}")
st.markdown(f"{description}")
st.markdown("**Projects:**")
for project in module_info['projects']:
st.markdown(f"- π οΈ {project}")
st.markdown("**Resources:**")
for resource in module_info['resources']:
st.markdown(f"- π {resource}")
col1, col2, col3 = st.columns(3)
with col1:
if st.button(f"Start Learning", key=f"learn_{module_name}"):
st.session_state.user_progress['completed_lessons'].append(module_name)
st.success(f"Started learning {module_name}!")
with col2:
if st.button(f"View Mind Map", key=f"mindmap_{module_name}"):
# Fixed: Store under user_progress
st.session_state.user_progress['mind_maps'][module_name] = module_info['topics']
with col3:
if st.button(f"Take Quiz", key=f"quiz_{module_name}"):
st.session_state.current_quiz = generate_quiz(module_name, 5)
st.experimental_rerun()
elif menu == "Practice":
st.markdown("<h1 class='main-header'>π» Practice Coding</h1>", unsafe_allow_html=True)
practice_type = st.selectbox(
"Select Practice Type",
["Python Basics", "Data Manipulation", "Machine Learning", "Deep Learning", "SQL"]
)
st.markdown("### π Coding Challenge")
challenges = {
"Python Basics": {
"title": "List Comprehension",
"problem": "Create a list of squares for numbers 1 to 10 using list comprehension",
"hint": "Use [x**2 for x in range(1, 11)]",
"solution": "squares = [x**2 for x in range(1, 11)]"
},
"Data Manipulation": {
"title": "Pandas DataFrame Operations",
"problem": "Filter a DataFrame to show only rows where 'age' > 25 and 'salary' > 50000",
"hint": "Use df[(df['age'] > 25) & (df['salary'] > 50000)]",
"solution": "filtered_df = df[(df['age'] > 25) & (df['salary'] > 50000)]"
},
"Machine Learning": {
"title": "Train-Test Split",
"problem": "Split your data into 80% training and 20% testing sets",
"hint": "Use train_test_split from sklearn.model_selection",
"solution": "from sklearn.model_selection import train_test_split\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)"
}
}
if practice_type in challenges:
challenge = challenges[practice_type]
st.markdown(f"**Challenge:** {challenge['title']}")
st.markdown(f"**Problem:** {challenge['problem']}")
code_input = st.text_area("Write your code here:", height=200)
col1, col2, col3 = st.columns(3)
with col1:
if st.button("Run Code"):
st.success("Code executed successfully! (Simulation)")
st.code("Output: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]")
with col2:
if st.button("Show Hint"):
st.info(f"Hint: {challenge['hint']}")
with col3:
if st.button("View Solution"):
st.code(challenge['solution'])
elif menu == "Projects":
st.markdown("<h1 class='main-header'>π οΈ Hands-on Projects</h1>", unsafe_allow_html=True)
project_category = st.selectbox(
"Select Project Category",
["Beginner Projects", "Intermediate Projects", "Advanced Projects", "Portfolio Projects"]
)
projects = {
"Beginner Projects": [
{
"name": "Titanic Survival Prediction",
"description": "Predict passenger survival using logistic regression",
"skills": ["Pandas", "Scikit-learn", "Data Visualization"],
"difficulty": "ββ",
"duration": "2 days",
"dataset": "Titanic passenger data"
},
{
"name": "Stock Price Analysis",
"description": "Analyze and visualize stock market trends",
"skills": ["Pandas", "Matplotlib", "Time Series"],
"difficulty": "ββ",
"duration": "3 days",
"dataset": "Historical stock prices"
}
],
"Intermediate Projects": [
{
"name": "Customer Segmentation",
"description": "Segment customers using clustering algorithms",
"skills": ["K-Means", "PCA", "Feature Engineering"],
"difficulty": "βββ",
"duration": "1 week",
"dataset": "Customer transaction data"
},
{
"name": "Sentiment Analysis",
"description": "Analyze sentiment from product reviews",
"skills": ["NLP", "NLTK", "Classification"],
"difficulty": "βββ",
"duration": "1 week",
"dataset": "Amazon product reviews"
}
],
"Advanced Projects": [
{
"name": "Image Generation with GANs",
"description": "Generate realistic images using Generative Adversarial Networks",
"skills": ["TensorFlow", "Deep Learning", "GANs"],
"difficulty": "ββββ",
"duration": "2 weeks",
"dataset": "MNIST/CIFAR-10"
},
{
"name": "Real-time Object Detection",
"description": "Detect objects in real-time video streams",
"skills": ["Computer Vision", "YOLO", "OpenCV"],
"difficulty": "ββββ",
"duration": "2 weeks",
"dataset": "COCO dataset"
}
]
}
if project_category in projects:
for project in projects[project_category]:
with st.container():
st.markdown(f"### {project['name']}")
st.markdown(f"**Description:** {project['description']}")
col1, col2, col3 = st.columns(3)
with col1:
st.markdown(f"**Difficulty:** {project['difficulty']}")
with col2:
st.markdown(f"**Duration:** {project['duration']}")
with col3:
st.markdown(f"**Dataset:** {project['dataset']}")
st.markdown("**Skills you'll learn:**")
for skill in project['skills']:
st.markdown(f"- {skill}")
col1, col2, col3 = st.columns(3)
with col1:
if st.button(f"Start Project", key=f"start_{project['name']}"):
st.session_state.user_progress['projects_completed'].append(project['name'])
st.success("Project started! Check your learning resources.")
with col2:
if st.button(f"View Solution", key=f"solution_{project['name']}"):
st.code("""
# Sample solution structure
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
# Load data
data = pd.read_csv('data.csv')
# Preprocessing
# ... your code here
# Model training
model = LogisticRegression()
model.fit(X_train, y_train)
# Evaluation
accuracy = model.score(X_test, y_test)
print(f'Accuracy: {accuracy}')
""")
with col3:
if st.button(f"Download Dataset", key=f"data_{project['name']}"):
st.info("Dataset downloaded! (Simulation)")
st.markdown("---")
elif menu == "Quizzes":
st.markdown("<h1 class='main-header'>π Knowledge Assessment</h1>", unsafe_allow_html=True)
quiz_topic = st.selectbox(
"Select Quiz Topic",
["Python Fundamentals", "Machine Learning", "Deep Learning", "Statistics", "SQL"]
)
if st.button("Start Quiz"):
st.session_state.current_quiz = generate_quiz(quiz_topic, 5)
st.session_state.quiz_answers = {}
st.session_state.quiz_submitted = False
if st.session_state.get('current_quiz'):
st.markdown(f"### Quiz: {quiz_topic}")
for i, q in enumerate(st.session_state.current_quiz):
st.markdown(f"**Question {i+1}:** {q['question']}")
answer = st.radio(
"Select your answer:",
q['options'],
key=f"q_{i}",
index=None
)
st.session_state.quiz_answers[i] = q['options'].index(answer) if answer else None
if st.button("Submit Quiz"):
score = 0
results = []
for i, q in enumerate(st.session_state.current_quiz):
user_answer = st.session_state.quiz_answers.get(i)
correct = user_answer == q['correct'] if user_answer is not None else False
if correct:
score += 1
results.append({
"question": q['question'],
"user_answer": q['options'][user_answer] if user_answer is not None else "Not answered",
"correct_answer": q['options'][q['correct']],
"explanation": q.get('explanation', ''),
"is_correct": correct
})
percentage = (score / len(st.session_state.current_quiz)) * 100
st.session_state.user_progress['quiz_scores'][quiz_topic] = percentage
st.session_state.quiz_results = results
st.session_state.quiz_submitted = True
if percentage >= 80:
st.success(f"Excellent! You scored {percentage:.0f}%")
elif percentage >= 60:
st.warning(f"Good job! You scored {percentage:.0f}%")
else:
st.error(f"Keep practicing! You scored {percentage:.0f}%")
if st.session_state.get('quiz_submitted', False):
st.markdown("### Detailed Results:")
for i, result in enumerate(st.session_state.quiz_results):
with st.expander(f"Question {i+1}"):
st.markdown(f"**Your answer:** {'β
' if result['is_correct'] else 'β'} {result['user_answer']}")
st.markdown(f"**Correct answer:** {result['correct_answer']}")
st.markdown(f"**Explanation:** {result['explanation']}")
elif menu == "Career Guide":
st.markdown("<h1 class='main-header'>πΌ Career Guidance</h1>", unsafe_allow_html=True)
tab1, tab2, tab3 = st.tabs(["Career Paths", "Skills Roadmap", "Interview Prep"])
with tab1:
st.markdown("### π― AI/Data Science Career Paths")
careers = {
"Data Scientist": {
"salary": "$120,000 - $180,000",
"skills": "Python, ML, Statistics, Communication",
"description": "Analyze complex data to help companies make decisions"
},
"ML Engineer": {
"salary": "$130,000 - $200,000",
"skills": "Python, MLOps, Cloud, Software Engineering",
"description": "Build and deploy ML models at scale"
},
"Data Analyst": {
"salary": "$70,000 - $110,000",
"skills": "SQL, Excel, Visualization, Business Acumen",
"description": "Transform data into actionable insights"
},
"AI Research Scientist": {
"salary": "$150,000 - $300,000",
"skills": "Deep Learning, Research, Mathematics, Publishing",
"description": "Push the boundaries of AI technology"
}
}
for role, info in careers.items():
with st.expander(f"π {role}"):
st.markdown(f"**Salary Range:** {info['salary']}")
st.markdown(f"**Key Skills:** {info['skills']}")
st.markdown(f"**Description:** {info['description']}")
col1, col2 = st.columns(2)
with col1:
if st.button(f"View Learning Path", key=f"path_{role}"):
path = calculate_learning_path(skill_level, role)
st.markdown("**Recommended Learning Path:**")
for i, module in enumerate(path, 1):
st.markdown(f"{i}. {module}")
with col2:
if st.button(f"Job Openings", key=f"jobs_{role}"):
st.info(f"Searching LinkedIn for {role} positions...")
time.sleep(1)
st.success(f"Found 25+ {role} positions on LinkedIn!")
with tab2:
st.markdown("### πΊοΈ Skills Roadmap")
skill_timeline = {
"Month 1-2": ["Python Basics", "Git/GitHub", "SQL Fundamentals"],
"Month 3-4": ["Data Analysis", "Statistics", "Visualization"],
"Month 5-6": ["Machine Learning", "Feature Engineering", "Model Evaluation"],
"Month 7-9": ["Deep Learning", "NLP/Computer Vision", "Cloud Platforms"],
"Month 10-12": ["MLOps", "Production Systems", "Advanced Topics"]
}
for period, skills in skill_timeline.items():
st.markdown(f"**{period}:**")
for skill in skills:
st.markdown(f"- {skill}")
st.markdown("---")
st.markdown("### π Skill Demand Analysis")
skill_demand = {
"Skill": ["Python", "SQL", "Machine Learning", "Deep Learning", "Cloud", "Data Visualization"],
"Demand (%)": [95, 85, 90, 75, 80, 70]
}
df_demand = pd.DataFrame(skill_demand)
fig = px.bar(df_demand, x="Skill", y="Demand (%)",
color="Skill", title="Industry Skill Demand")
st.plotly_chart(fig, use_container_width=True)
with tab3:
st.markdown("### π€ Interview Preparation")
interview_topics = {
"Technical Questions": [
"Explain the bias-variance tradeoff",
"What is gradient descent?",
"Difference between L1 and L2 regularization",
"How do you handle imbalanced datasets?"
],
"Behavioral Questions": [
"Tell me about a challenging project",
"How do you handle conflicting priorities?",
"Describe a time you worked with stakeholders",
"How do you stay updated with AI trends?"
],
"Case Studies": [
"Design a recommendation system",
"Predict customer churn",
"Detect fraudulent transactions",
"Optimize marketing campaigns"
]
}
for category, questions in interview_topics.items():
with st.expander(f"π {category}"):
for q in questions:
st.markdown(f"β’ {q}")
col1, col2 = st.columns(2)
with col1:
if st.button(f"Practice {category}", key=f"practice_{category}"):
st.info("Practice session started! Prepare your answers and time yourself.")
with col2:
if st.button(f"View Answers", key=f"answers_{category}"):
st.success("Sample answers loaded. Compare with your responses.")
elif menu == "Resume Builder":
st.markdown("<h1 class='main-header'>π ATS-Optimized Resume Builder</h1>", unsafe_allow_html=True)
tab1, tab2, tab3 = st.tabs(["Resume Analysis", "LinkedIn Optimizer", "Cover Letter"])
with tab1:
st.markdown("### π ATS Resume Analyzer")
job_role = st.selectbox(
"Select Target Role",
list(JOB_TEMPLATES.keys())
)
resume_text = st.text_area(
"Paste your resume text here:",
height=300,
placeholder="Copy and paste your entire resume content..."
)
if st.button("Analyze Resume"):
if resume_text:
analysis = analyze_resume_ats(resume_text, job_role)
# Display ATS Score
col1, col2 = st.columns(2)
with col1:
score_color = "green" if analysis['score'] >= 80 else "orange" if analysis['score'] >= 60 else "red"
st.markdown(f"### ATS Score: <span style='color:{score_color}'>{analysis['score']:.0f}%</span>", unsafe_allow_html=True)
with col2:
st.metric("Skills Match", f"{len(analysis['found_skills'])}/{len(JOB_TEMPLATES[job_role]['skills'])}")
# Found skills
if analysis['found_skills']:
st.success("β
**Skills Found:**")
st.write(", ".join(analysis['found_skills']))
# Missing skills
if analysis['missing_skills']:
st.warning("β οΈ **Missing Skills:**")
st.write(", ".join(analysis['missing_skills']))
# Recommendations
st.markdown("### π‘ Recommendations:")
for rec in analysis['recommendations']:
st.markdown(f"β’ {rec}")
# Save job application
st.session_state.user_progress['job_applications'].append({
"role": job_role,
"date": datetime.now().strftime("%Y-%m-%d"),
"score": analysis['score']
})
else:
st.error("Please paste your resume text")
with tab2:
st.markdown("### π LinkedIn Profile Optimizer")
linkedin_sections = {
"Headline": "Data Scientist | Machine Learning | Python | Transforming Data into Insights",
"Summary": "Passionate data scientist with 3+ years of experience in building ML models that drive business value. Skilled in Python, TensorFlow, and cloud deployment.",
"Skills": ["Python", "Machine Learning", "Deep Learning", "SQL", "TensorFlow", "PyTorch", "AWS", "Docker"]
}
for section, content in linkedin_sections.items():
st.markdown(f"**{section} Template:**")
if isinstance(content, list):
st.write(", ".join(content))
else:
st.write(content)
st.markdown("### π― LinkedIn Tips:")
tips = [
"Use keywords from job descriptions in your headline and summary",
"Add 50+ skills and get endorsements for top skills",
"Write detailed descriptions for each role with quantified achievements",
"Add relevant certifications and courses",
"Engage with content in your field regularly"
]
for tip in tips:
st.markdown(f"β’ {tip}")
with tab3:
st.markdown("### βοΈ Cover Letter Generator")
company_name = st.text_input("Company Name")
position = st.text_input("Position")
user_skills = st.multiselect("Your Top Skills", ["Python", "Machine Learning", "Data Analysis", "SQL", "Deep Learning"])
if st.button("Generate Cover Letter"):
if company_name and position and user_skills:
cover_letter = generate_cover_letter(company_name, position, user_skills)
st.text_area("Generated Cover Letter", cover_letter, height=300)
st.download_button("Download Cover Letter", cover_letter, file_name=f"cover_letter_{company_name}.txt")
else:
st.error("Please fill in all fields")
elif menu == "Mind Maps":
st.markdown("<h1 class='main-header'>πΊοΈ Visual Learning with Mind Maps</h1>", unsafe_allow_html=True)
col1, col2 = st.columns([1, 3])
with col1:
st.markdown("### π§ Concept Maps")
selected_map = st.selectbox("Select a Concept", list(MIND_MAP_DB.keys()))
st.markdown("### β¨ Create Your Own")
new_map_topic = st.text_input("Map Topic")
new_concepts = st.text_area("Concepts (comma separated)")
if st.button("Generate Mind Map"):
if new_map_topic and new_concepts:
concepts_dict = {concept.strip(): f"Description of {concept.strip()}"
for concept in new_concepts.split(",")}
# Fixed: Store under user_progress
st.session_state.user_progress['mind_maps'][new_map_topic] = concepts_dict
st.success("Mind map created!")
with col2:
if selected_map in MIND_MAP_DB:
st.markdown(f"### {selected_map}")
fig = create_mind_map(selected_map, MIND_MAP_DB[selected_map])
st.plotly_chart(fig, use_container_width=True)
# Fixed: Access through user_progress
if st.session_state.user_progress['mind_maps']:
st.markdown("### ποΈ Your Custom Maps")
for topic, concepts in st.session_state.user_progress['mind_maps'].items():
with st.expander(topic):
fig = create_mind_map(topic, concepts)
st.plotly_chart(fig, use_container_width=True)
elif menu == "Progress":
st.markdown("<h1 class='main-header'>π Your Learning Progress</h1>", unsafe_allow_html=True)
col1, col2 = st.columns(2)
with col1:
st.markdown("### π Completed Lessons")
if st.session_state.user_progress['completed_lessons']:
for lesson in st.session_state.user_progress['completed_lessons']:
st.markdown(f"- β
{lesson}")
else:
st.markdown("No lessons completed yet")
st.markdown("### π Projects Completed")
if st.session_state.user_progress['projects_completed']:
for project in st.session_state.user_progress['projects_completed']:
st.markdown(f"- π οΈ {project}")
else:
st.markdown("No projects completed yet")
with col2:
st.markdown("### π Quiz Scores")
if st.session_state.user_progress['quiz_scores']:
scores = st.session_state.user_progress['quiz_scores']
df_scores = pd.DataFrame({
"Topic": list(scores.keys()),
"Score": list(scores.values())
})
fig = px.bar(df_scores, x="Topic", y="Score",
color="Topic", title="Quiz Performance")
st.plotly_chart(fig, use_container_width=True)
else:
st.markdown("No quiz scores yet")
st.markdown("### πΌ Job Applications")
if st.session_state.user_progress.get('job_applications'):
apps = st.session_state.user_progress['job_applications']
df_apps = pd.DataFrame(apps)
st.dataframe(df_apps)
else:
st.markdown("No job applications tracked yet")
# Footer
st.markdown("---")
st.markdown("""
<div style="text-align: center; padding: 1rem;">
<p>AI & Data Science Learning Platform β’ Built with Streamlit β’
<a href="https://huggingface.co" target="_blank">Deploy on Hugging Face</a></p>
</div>
""", unsafe_allow_html=True) |