Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,88 @@ SYSTEM_PROMPT = (
|
|
| 22 |
"You can explain code snippets, generate exercises and quizzes, and recommend projects. "
|
| 23 |
"You never overwhelm users with jargon. Instead, you scaffold complex concepts in simple, digestible steps."
|
| 24 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# Learning resources
|
| 26 |
LEARNING_RESOURCES = {
|
| 27 |
"python_beginner": [
|
|
@@ -67,6 +149,7 @@ LEARNING_RESOURCES = {
|
|
| 67 |
{"title": "Berkeley CS285: Deep Reinforcement Learning", "url": "https://rail.eecs.berkeley.edu/deeprlcourse/"}
|
| 68 |
]
|
| 69 |
}
|
|
|
|
| 70 |
# Practice project ideas
|
| 71 |
PROJECT_IDEAS = {
|
| 72 |
"python_beginner": [
|
|
@@ -119,6 +202,7 @@ PROJECT_IDEAS = {
|
|
| 119 |
"Autonomous Data Analysis System"
|
| 120 |
]
|
| 121 |
}
|
|
|
|
| 122 |
# User session data store
|
| 123 |
SESSION_DATA = {}
|
| 124 |
|
|
@@ -146,13 +230,31 @@ def recommend_learning_path(age, goals, knowledge_level, interests):
|
|
| 146 |
paths.append("python_beginner")
|
| 147 |
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 148 |
paths.append("data_science_beginner")
|
| 149 |
-
elif "intermediate" in knowledge_level.lower()
|
| 150 |
if any(topic in interests.lower() for topic in ["python", "programming", "coding"]):
|
| 151 |
paths.append("python_intermediate")
|
| 152 |
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 153 |
paths.append("data_science_advanced")
|
| 154 |
if any(topic in interests.lower() for topic in ["ai", "machine learning", "deep learning"]):
|
| 155 |
paths.append("ai_specialization")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
# Default path if no matches
|
| 158 |
if not paths:
|
|
@@ -160,42 +262,76 @@ def recommend_learning_path(age, goals, knowledge_level, interests):
|
|
| 160 |
|
| 161 |
return [LEARNING_PATHS[path] for path in paths if path in LEARNING_PATHS]
|
| 162 |
|
| 163 |
-
def get_recommended_resources(interests):
|
| 164 |
-
"""Get recommended learning resources based on interests"""
|
| 165 |
resources = []
|
| 166 |
-
if any(topic in interests.lower() for topic in ["python", "programming", "coding"]):
|
| 167 |
-
resources.extend(LEARNING_RESOURCES["python"])
|
| 168 |
-
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 169 |
-
resources.extend(LEARNING_RESOURCES["data_science"])
|
| 170 |
-
if any(topic in interests.lower() for topic in ["ai", "machine learning", "deep learning"]):
|
| 171 |
-
resources.extend(LEARNING_RESOURCES["ai"])
|
| 172 |
-
|
| 173 |
-
# If no specific interests match, provide general resources
|
| 174 |
-
if not resources:
|
| 175 |
-
for category in LEARNING_RESOURCES:
|
| 176 |
-
resources.extend(LEARNING_RESOURCES[category][:1]) # Add first resource from each category
|
| 177 |
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
-
def get_project_ideas(
|
| 181 |
"""Get project ideas based on recommended learning paths"""
|
| 182 |
ideas = []
|
| 183 |
-
|
|
|
|
|
|
|
| 184 |
path_id = next((k for k, v in LEARNING_PATHS.items() if v["title"] == path["title"]), None)
|
| 185 |
-
if path_id:
|
| 186 |
-
|
| 187 |
-
category = "python_beginner" if "beginner" in path_id else "python_intermediate"
|
| 188 |
-
ideas.extend(PROJECT_IDEAS[category])
|
| 189 |
-
elif path_id.startswith("data_science"):
|
| 190 |
-
ideas.extend(PROJECT_IDEAS["data_science"])
|
| 191 |
-
elif path_id.startswith("ai"):
|
| 192 |
-
ideas.extend(PROJECT_IDEAS["ai"])
|
| 193 |
|
| 194 |
# If no specific paths match, provide some general project ideas
|
| 195 |
if not ideas:
|
| 196 |
-
ideas = PROJECT_IDEAS["python_beginner"][:2] + PROJECT_IDEAS["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
-
return
|
| 199 |
|
| 200 |
def generate_quiz(topic, difficulty):
|
| 201 |
"""Generate a quiz based on the topic and difficulty"""
|
|
@@ -221,11 +357,12 @@ def generate_quiz(topic, difficulty):
|
|
| 221 |
|
| 222 |
return quiz_response.choices[0].message.content
|
| 223 |
|
| 224 |
-
def create_study_plan(topic, time_available, goals):
|
| 225 |
"""Create a personalized study plan"""
|
| 226 |
plan_prompt = f"""
|
| 227 |
Create a structured study plan for learning {topic} with {time_available} hours per week available for study.
|
| 228 |
The learner's goal is: {goals}
|
|
|
|
| 229 |
|
| 230 |
Include:
|
| 231 |
1. Weekly breakdown of topics
|
|
@@ -233,6 +370,8 @@ def create_study_plan(topic, time_available, goals):
|
|
| 233 |
3. Recommended resources for each week
|
| 234 |
4. Milestone projects or assessments
|
| 235 |
5. Tips for effective learning
|
|
|
|
|
|
|
| 236 |
"""
|
| 237 |
|
| 238 |
# Use Groq to generate the study plan
|
|
@@ -353,7 +492,7 @@ def user_onboarding(session_id, age, goals, knowledge_level, interests, study_ti
|
|
| 353 |
|
| 354 |
# Generate recommendations
|
| 355 |
learning_paths = recommend_learning_path(age, goals, knowledge_level, interests)
|
| 356 |
-
resources = get_recommended_resources(interests)
|
| 357 |
project_ideas = get_project_ideas(learning_paths)
|
| 358 |
|
| 359 |
# Save recommendations to session
|
|
@@ -419,7 +558,11 @@ def generate_recommendations(session_id):
|
|
| 419 |
user_data.get('knowledge_level', ''),
|
| 420 |
user_data.get('interests', '')
|
| 421 |
)
|
| 422 |
-
resources = get_recommended_resources(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 423 |
project_ideas = get_project_ideas(learning_paths)
|
| 424 |
|
| 425 |
# Save recommendations to session
|
|
@@ -461,9 +604,60 @@ def handle_study_plan_request(session_id, topic, time_available):
|
|
| 461 |
return "Please complete your profile first by going to the Profile tab."
|
| 462 |
|
| 463 |
goals = user_data.get('goals', 'improving skills')
|
| 464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
return study_plan
|
| 466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
def create_chatbot():
|
| 468 |
"""Create the Gradio interface for the chatbot"""
|
| 469 |
# Generate a random session ID for the user
|
|
@@ -537,6 +731,13 @@ def create_chatbot():
|
|
| 537 |
.progress-module.completed {{
|
| 538 |
background-color: #d4edda;
|
| 539 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 540 |
"""
|
| 541 |
|
| 542 |
with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
|
|
|
| 22 |
"You can explain code snippets, generate exercises and quizzes, and recommend projects. "
|
| 23 |
"You never overwhelm users with jargon. Instead, you scaffold complex concepts in simple, digestible steps."
|
| 24 |
)
|
| 25 |
+
|
| 26 |
+
# Define learning paths
|
| 27 |
+
LEARNING_PATHS = {
|
| 28 |
+
"python_beginner": {
|
| 29 |
+
"title": "Python Fundamentals",
|
| 30 |
+
"description": "Learn Python basics from variables to functions",
|
| 31 |
+
"modules": [
|
| 32 |
+
"Variables & Data Types",
|
| 33 |
+
"Control Flow",
|
| 34 |
+
"Functions",
|
| 35 |
+
"Data Structures",
|
| 36 |
+
"File I/O"
|
| 37 |
+
]
|
| 38 |
+
},
|
| 39 |
+
"python_intermediate": {
|
| 40 |
+
"title": "Intermediate Python",
|
| 41 |
+
"description": "Advance your Python skills with OOP and more",
|
| 42 |
+
"modules": [
|
| 43 |
+
"Object-Oriented Programming",
|
| 44 |
+
"Modules & Packages",
|
| 45 |
+
"Error Handling",
|
| 46 |
+
"List Comprehensions",
|
| 47 |
+
"Decorators & Generators"
|
| 48 |
+
]
|
| 49 |
+
},
|
| 50 |
+
"data_science_beginner": {
|
| 51 |
+
"title": "Data Science Foundations",
|
| 52 |
+
"description": "Begin your data science journey",
|
| 53 |
+
"modules": [
|
| 54 |
+
"Numpy Basics",
|
| 55 |
+
"Pandas Fundamentals",
|
| 56 |
+
"Data Visualization",
|
| 57 |
+
"Basic Statistics",
|
| 58 |
+
"Intro to Machine Learning"
|
| 59 |
+
]
|
| 60 |
+
},
|
| 61 |
+
"data_science_advanced": {
|
| 62 |
+
"title": "Advanced Data Science",
|
| 63 |
+
"description": "Master complex data science concepts",
|
| 64 |
+
"modules": [
|
| 65 |
+
"Advanced ML Algorithms",
|
| 66 |
+
"Feature Engineering",
|
| 67 |
+
"Time Series Analysis",
|
| 68 |
+
"Natural Language Processing",
|
| 69 |
+
"Deep Learning Basics"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
"ai_specialization": {
|
| 73 |
+
"title": "AI Specialization",
|
| 74 |
+
"description": "Focus on artificial intelligence concepts",
|
| 75 |
+
"modules": [
|
| 76 |
+
"Neural Networks",
|
| 77 |
+
"Computer Vision",
|
| 78 |
+
"Advanced NLP",
|
| 79 |
+
"Reinforcement Learning",
|
| 80 |
+
"AI Ethics"
|
| 81 |
+
]
|
| 82 |
+
},
|
| 83 |
+
"generative_ai": {
|
| 84 |
+
"title": "Generative AI",
|
| 85 |
+
"description": "Learn how to build and work with generative AI systems",
|
| 86 |
+
"modules": [
|
| 87 |
+
"Generative Models Overview",
|
| 88 |
+
"GANs & Diffusion Models",
|
| 89 |
+
"Large Language Models",
|
| 90 |
+
"Prompt Engineering",
|
| 91 |
+
"Fine-tuning & RLHF"
|
| 92 |
+
]
|
| 93 |
+
},
|
| 94 |
+
"agentic_ai": {
|
| 95 |
+
"title": "Agentic AI Systems",
|
| 96 |
+
"description": "Explore AI systems that can act autonomously",
|
| 97 |
+
"modules": [
|
| 98 |
+
"Foundations of AI Agents",
|
| 99 |
+
"Planning & Decision Making",
|
| 100 |
+
"Tool-using AI Systems",
|
| 101 |
+
"Multi-agent Architectures",
|
| 102 |
+
"Human-AI Collaboration"
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
# Learning resources
|
| 108 |
LEARNING_RESOURCES = {
|
| 109 |
"python_beginner": [
|
|
|
|
| 149 |
{"title": "Berkeley CS285: Deep Reinforcement Learning", "url": "https://rail.eecs.berkeley.edu/deeprlcourse/"}
|
| 150 |
]
|
| 151 |
}
|
| 152 |
+
|
| 153 |
# Practice project ideas
|
| 154 |
PROJECT_IDEAS = {
|
| 155 |
"python_beginner": [
|
|
|
|
| 202 |
"Autonomous Data Analysis System"
|
| 203 |
]
|
| 204 |
}
|
| 205 |
+
|
| 206 |
# User session data store
|
| 207 |
SESSION_DATA = {}
|
| 208 |
|
|
|
|
| 230 |
paths.append("python_beginner")
|
| 231 |
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 232 |
paths.append("data_science_beginner")
|
| 233 |
+
elif "intermediate" in knowledge_level.lower():
|
| 234 |
if any(topic in interests.lower() for topic in ["python", "programming", "coding"]):
|
| 235 |
paths.append("python_intermediate")
|
| 236 |
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 237 |
paths.append("data_science_advanced")
|
| 238 |
if any(topic in interests.lower() for topic in ["ai", "machine learning", "deep learning"]):
|
| 239 |
paths.append("ai_specialization")
|
| 240 |
+
if any(topic in interests.lower() for topic in ["generative", "gpt", "llm", "diffusion"]):
|
| 241 |
+
paths.append("generative_ai")
|
| 242 |
+
elif "advanced" in knowledge_level.lower() or "expert" in knowledge_level.lower():
|
| 243 |
+
if any(topic in interests.lower() for topic in ["ai", "machine learning", "deep learning"]):
|
| 244 |
+
paths.append("ai_specialization")
|
| 245 |
+
if any(topic in interests.lower() for topic in ["generative", "gpt", "llm", "diffusion"]):
|
| 246 |
+
paths.append("generative_ai")
|
| 247 |
+
if any(topic in interests.lower() for topic in ["agent", "autonomous", "planning"]):
|
| 248 |
+
paths.append("agentic_ai")
|
| 249 |
+
|
| 250 |
+
# Check for specific mentions of generative or agentic AI regardless of level
|
| 251 |
+
if any(topic in interests.lower() for topic in ["generative", "gpt", "llm", "diffusion"]):
|
| 252 |
+
if "generative_ai" not in paths:
|
| 253 |
+
paths.append("generative_ai")
|
| 254 |
+
|
| 255 |
+
if any(topic in interests.lower() for topic in ["agent", "autonomous", "planning"]):
|
| 256 |
+
if "agentic_ai" not in paths:
|
| 257 |
+
paths.append("agentic_ai")
|
| 258 |
|
| 259 |
# Default path if no matches
|
| 260 |
if not paths:
|
|
|
|
| 262 |
|
| 263 |
return [LEARNING_PATHS[path] for path in paths if path in LEARNING_PATHS]
|
| 264 |
|
| 265 |
+
def get_recommended_resources(interests, knowledge_level, recommended_paths):
|
| 266 |
+
"""Get recommended learning resources based on interests and recommended paths"""
|
| 267 |
resources = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
+
# Get path IDs from recommended paths
|
| 270 |
+
path_ids = []
|
| 271 |
+
for path in recommended_paths:
|
| 272 |
+
path_id = next((k for k, v in LEARNING_PATHS.items() if v["title"] == path["title"]), None)
|
| 273 |
+
if path_id:
|
| 274 |
+
path_ids.append(path_id)
|
| 275 |
+
|
| 276 |
+
# Add resources for each recommended path
|
| 277 |
+
for path_id in path_ids:
|
| 278 |
+
if path_id in LEARNING_RESOURCES:
|
| 279 |
+
resources.extend(LEARNING_RESOURCES[path_id])
|
| 280 |
+
|
| 281 |
+
# If no specific paths match, provide resources based on interests and level
|
| 282 |
+
if not resources:
|
| 283 |
+
if "beginner" in knowledge_level.lower():
|
| 284 |
+
if any(topic in interests.lower() for topic in ["python", "programming", "coding"]):
|
| 285 |
+
resources.extend(LEARNING_RESOURCES["python_beginner"])
|
| 286 |
+
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 287 |
+
resources.extend(LEARNING_RESOURCES["data_science_beginner"])
|
| 288 |
+
elif "intermediate" in knowledge_level.lower():
|
| 289 |
+
if any(topic in interests.lower() for topic in ["python", "programming", "coding"]):
|
| 290 |
+
resources.extend(LEARNING_RESOURCES["python_intermediate"])
|
| 291 |
+
if any(topic in interests.lower() for topic in ["data", "analysis", "statistics"]):
|
| 292 |
+
resources.extend(LEARNING_RESOURCES["data_science_advanced"])
|
| 293 |
+
elif "advanced" in knowledge_level.lower() or "expert" in knowledge_level.lower():
|
| 294 |
+
if any(topic in interests.lower() for topic in ["ai", "machine learning", "deep learning"]):
|
| 295 |
+
resources.extend(LEARNING_RESOURCES["ai_specialization"])
|
| 296 |
+
|
| 297 |
+
# If still no resources, provide general resources
|
| 298 |
+
if not resources:
|
| 299 |
+
for category in ["python_beginner", "data_science_beginner"]:
|
| 300 |
+
resources.extend(LEARNING_RESOURCES[category][:2])
|
| 301 |
+
|
| 302 |
+
# Remove duplicates while preserving order
|
| 303 |
+
unique_resources = []
|
| 304 |
+
seen_titles = set()
|
| 305 |
+
for resource in resources:
|
| 306 |
+
if resource["title"] not in seen_titles:
|
| 307 |
+
seen_titles.add(resource["title"])
|
| 308 |
+
unique_resources.append(resource)
|
| 309 |
+
|
| 310 |
+
return unique_resources
|
| 311 |
|
| 312 |
+
def get_project_ideas(recommended_paths):
|
| 313 |
"""Get project ideas based on recommended learning paths"""
|
| 314 |
ideas = []
|
| 315 |
+
|
| 316 |
+
# Get project ideas for each recommended path
|
| 317 |
+
for path in recommended_paths:
|
| 318 |
path_id = next((k for k, v in LEARNING_PATHS.items() if v["title"] == path["title"]), None)
|
| 319 |
+
if path_id and path_id in PROJECT_IDEAS:
|
| 320 |
+
ideas.extend(PROJECT_IDEAS[path_id])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
# If no specific paths match, provide some general project ideas
|
| 323 |
if not ideas:
|
| 324 |
+
ideas = PROJECT_IDEAS["python_beginner"][:2] + PROJECT_IDEAS["data_science_beginner"][:2]
|
| 325 |
+
|
| 326 |
+
# Remove duplicates while preserving order
|
| 327 |
+
unique_ideas = []
|
| 328 |
+
seen_ideas = set()
|
| 329 |
+
for idea in ideas:
|
| 330 |
+
if idea not in seen_ideas:
|
| 331 |
+
seen_ideas.add(idea)
|
| 332 |
+
unique_ideas.append(idea)
|
| 333 |
|
| 334 |
+
return unique_ideas[:5] # Return up to 5 project ideas
|
| 335 |
|
| 336 |
def generate_quiz(topic, difficulty):
|
| 337 |
"""Generate a quiz based on the topic and difficulty"""
|
|
|
|
| 357 |
|
| 358 |
return quiz_response.choices[0].message.content
|
| 359 |
|
| 360 |
+
def create_study_plan(topic, time_available, goals, knowledge_level):
|
| 361 |
"""Create a personalized study plan"""
|
| 362 |
plan_prompt = f"""
|
| 363 |
Create a structured study plan for learning {topic} with {time_available} hours per week available for study.
|
| 364 |
The learner's goal is: {goals}
|
| 365 |
+
The learner's knowledge level is: {knowledge_level}
|
| 366 |
|
| 367 |
Include:
|
| 368 |
1. Weekly breakdown of topics
|
|
|
|
| 370 |
3. Recommended resources for each week
|
| 371 |
4. Milestone projects or assessments
|
| 372 |
5. Tips for effective learning
|
| 373 |
+
|
| 374 |
+
Make this plan specific, actionable, and tailored to the knowledge level.
|
| 375 |
"""
|
| 376 |
|
| 377 |
# Use Groq to generate the study plan
|
|
|
|
| 492 |
|
| 493 |
# Generate recommendations
|
| 494 |
learning_paths = recommend_learning_path(age, goals, knowledge_level, interests)
|
| 495 |
+
resources = get_recommended_resources(interests, knowledge_level, learning_paths)
|
| 496 |
project_ideas = get_project_ideas(learning_paths)
|
| 497 |
|
| 498 |
# Save recommendations to session
|
|
|
|
| 558 |
user_data.get('knowledge_level', ''),
|
| 559 |
user_data.get('interests', '')
|
| 560 |
)
|
| 561 |
+
resources = get_recommended_resources(
|
| 562 |
+
user_data.get('interests', ''),
|
| 563 |
+
user_data.get('knowledge_level', ''),
|
| 564 |
+
learning_paths
|
| 565 |
+
)
|
| 566 |
project_ideas = get_project_ideas(learning_paths)
|
| 567 |
|
| 568 |
# Save recommendations to session
|
|
|
|
| 604 |
return "Please complete your profile first by going to the Profile tab."
|
| 605 |
|
| 606 |
goals = user_data.get('goals', 'improving skills')
|
| 607 |
+
knowledge_level = user_data.get('knowledge_level', 'Beginner')
|
| 608 |
+
study_plan = create_study_plan(topic, time_available, goals, knowledge_level)
|
| 609 |
+
|
| 610 |
+
# Save the generated study plan to the session
|
| 611 |
+
if 'study_plans' not in user_data:
|
| 612 |
+
user_data['study_plans'] = {}
|
| 613 |
+
|
| 614 |
+
study_plan_id = f"{topic}_{time_available}_{datetime.now().strftime('%Y%m%d%H%M%S')}"
|
| 615 |
+
user_data['study_plans'][study_plan_id] = {
|
| 616 |
+
'topic': topic,
|
| 617 |
+
'time_available': time_available,
|
| 618 |
+
'plan': study_plan,
|
| 619 |
+
'created_at': datetime.now().isoformat()
|
| 620 |
+
}
|
| 621 |
+
save_session(session_id, user_data)
|
| 622 |
+
|
| 623 |
return study_plan
|
| 624 |
|
| 625 |
+
def add_generative_ai_info():
|
| 626 |
+
"""Return information about Generative AI"""
|
| 627 |
+
return """
|
| 628 |
+
## What is Generative AI?
|
| 629 |
+
|
| 630 |
+
Generative AI refers to artificial intelligence systems that can create new content, such as text, images, code, audio, video, or 3D models. Unlike traditional AI systems that are designed to recognize patterns or make predictions, generative AI creates original outputs based on the patterns it has learned during training.
|
| 631 |
+
|
| 632 |
+
### Key Concepts in Generative AI:
|
| 633 |
+
|
| 634 |
+
- **Large Language Models (LLMs)**: Text generation systems like GPT-4, LLaMA, Claude, etc.
|
| 635 |
+
- **Diffusion Models**: For image generation (DALL-E, Midjourney, Stable Diffusion)
|
| 636 |
+
- **Prompt Engineering**: The art of crafting inputs to get desired outputs
|
| 637 |
+
- **Fine-tuning**: Adapting pre-trained models for specific domains or tasks
|
| 638 |
+
- **RLHF (Reinforcement Learning from Human Feedback)**: Method for aligning AI with human preferences
|
| 639 |
+
|
| 640 |
+
Learning generative AI involves understanding these foundation models, how they work, and how to effectively use and customize them for various applications.
|
| 641 |
+
"""
|
| 642 |
+
|
| 643 |
+
def add_agentic_ai_info():
|
| 644 |
+
"""Return information about Agentic AI"""
|
| 645 |
+
return """
|
| 646 |
+
## What is Agentic AI?
|
| 647 |
+
|
| 648 |
+
Agentic AI refers to AI systems that can act autonomously to achieve specified goals. Unlike passive AI systems that respond only when prompted, agentic AI can take initiative, make decisions, use tools, and perform sequences of actions to accomplish tasks.
|
| 649 |
+
|
| 650 |
+
### Key Concepts in Agentic AI:
|
| 651 |
+
|
| 652 |
+
- **Planning & Decision Making**: AI systems that can formulate and execute plans
|
| 653 |
+
- **Tool Use**: AI that can leverage external tools and APIs
|
| 654 |
+
- **Autonomous Execution**: Systems that can work without constant human supervision
|
| 655 |
+
- **Multi-agent Systems**: Multiple AI agents collaborating or competing
|
| 656 |
+
- **Memory & Context Management**: How agents maintain state across interactions
|
| 657 |
+
|
| 658 |
+
Agentic AI represents an evolution from AI as a passive tool to AI as an active collaborator that can work independently while remaining aligned with human goals and values.
|
| 659 |
+
"""
|
| 660 |
+
|
| 661 |
def create_chatbot():
|
| 662 |
"""Create the Gradio interface for the chatbot"""
|
| 663 |
# Generate a random session ID for the user
|
|
|
|
| 731 |
.progress-module.completed {{
|
| 732 |
background-color: #d4edda;
|
| 733 |
}}
|
| 734 |
+
.info-box {{
|
| 735 |
+
background-color: #e7f5fe;
|
| 736 |
+
border-left: 4px solid var(--primary-color);
|
| 737 |
+
padding: 15px;
|
| 738 |
+
margin: 15px 0;
|
| 739 |
+
border-radius: 4px;
|
| 740 |
+
}}
|
| 741 |
"""
|
| 742 |
|
| 743 |
with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="blue")) as demo:
|