Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import json | |
| import time | |
| import random | |
| from datetime import datetime | |
| # Set page config | |
| st.set_page_config( | |
| page_title="Training Course Outline Generator", | |
| page_icon="π", | |
| layout="wide", | |
| initial_sidebar_state="collapsed" | |
| ) | |
| # Custom CSS | |
| st.markdown(""" | |
| <style> | |
| .main .block-container { | |
| padding-top: 2rem; | |
| padding-bottom: 2rem; | |
| max-width: 1000px; | |
| margin: 0 auto; | |
| } | |
| .stApp { | |
| background-color: #f8f9fa; | |
| } | |
| .title-area { | |
| text-align: center; | |
| margin-bottom: 2rem; | |
| } | |
| .custom-subheader { | |
| background-color: #f0f2f6; | |
| padding: 10px; | |
| border-radius: 5px; | |
| margin-bottom: 10px; | |
| font-weight: 600; | |
| } | |
| .generated-outline { | |
| border: 1px solid #ddd; | |
| border-radius: 5px; | |
| padding: 20px; | |
| background-color: white; | |
| box-shadow: 0 2px 4px rgba(0,0,0,0.1); | |
| } | |
| .stButton button { | |
| width: 100%; | |
| } | |
| .footnote { | |
| font-size: 0.8rem; | |
| color: #6c757d; | |
| margin-top: 2rem; | |
| } | |
| .settings-section { | |
| background-color: #f8f9fa; | |
| padding: 15px; | |
| border-radius: 5px; | |
| margin-bottom: 20px; | |
| } | |
| .examples-section { | |
| background-color: #e9f7fe; | |
| padding: 15px; | |
| border-radius: 5px; | |
| margin-bottom: 20px; | |
| } | |
| .placeholder-area { | |
| border: 2px dashed #ddd; | |
| border-radius: 10px; | |
| padding: 40px; | |
| text-align: center; | |
| background-color: #f8f9fa; | |
| color: #666; | |
| } | |
| .metric-card { | |
| background-color: #f8f9fa; | |
| padding: 15px; | |
| border-radius: 8px; | |
| border-left: 4px solid #007bff; | |
| margin-bottom: 15px; | |
| } | |
| .outline-section { | |
| background-color: #ffffff; | |
| padding: 20px; | |
| border-radius: 8px; | |
| margin-bottom: 20px; | |
| border: 1px solid #e9ecef; | |
| } | |
| .success-indicator { | |
| background-color: #d4edda; | |
| color: #155724; | |
| padding: 10px; | |
| border-radius: 5px; | |
| border: 1px solid #c3e6cb; | |
| margin-bottom: 15px; | |
| } | |
| .recommendation { | |
| background-color: #fff3cd; | |
| color: #856404; | |
| padding: 15px; | |
| border-radius: 5px; | |
| border: 1px solid #ffeaa7; | |
| margin-top: 15px; | |
| } | |
| .partnership-cta { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| color: white; | |
| padding: 20px; | |
| border-radius: 10px; | |
| text-align: center; | |
| margin-top: 20px; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| # Title and description | |
| st.markdown(""" | |
| <div class="title-area"> | |
| <h1>Training Course Outline Generator π</h1> | |
| <p>Transform your training ideas into structured, actionable course outlines. Perfect for L&D leaders planning their next training initiative!</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # Initialize session state | |
| if "generated_outline" not in st.session_state: | |
| st.session_state["generated_outline"] = None | |
| if "course_history" not in st.session_state: | |
| st.session_state["course_history"] = [] | |
| # Helper functions | |
| def calculate_estimated_duration(delivery_method, content_depth, audience_size): | |
| """Calculate estimated course duration based on inputs""" | |
| base_hours = { | |
| "In-person workshop": 8, | |
| "Virtual live session": 4, | |
| "Self-paced online": 6, | |
| "Blended learning": 12, | |
| "Microlearning series": 2, | |
| "On-the-job training": 16 | |
| } | |
| depth_multiplier = { | |
| "Basic overview": 0.7, | |
| "Intermediate depth": 1.0, | |
| "Advanced/comprehensive": 1.5, | |
| "Expert level": 2.0 | |
| } | |
| size_factor = 1.0 | |
| if audience_size == "Large group (20+)": | |
| size_factor = 1.2 | |
| elif audience_size == "Small team (5-15)": | |
| size_factor = 0.9 | |
| estimated = base_hours.get(delivery_method, 6) * depth_multiplier.get(content_depth, 1.0) * size_factor | |
| return max(1, round(estimated)) | |
| def generate_learning_objectives(course_topic, target_audience, goals): | |
| """Generate sample learning objectives based on inputs""" | |
| objectives = [] | |
| # Create objectives based on common learning patterns | |
| action_verbs = ["identify", "analyze", "implement", "evaluate", "create", "demonstrate", "apply", "compare"] | |
| if goals: | |
| goal_keywords = goals.lower().split() | |
| if any(word in goal_keywords for word in ["skill", "skills", "ability", "practice"]): | |
| objectives.append(f"Demonstrate practical {course_topic.lower()} skills relevant to {target_audience.lower()}") | |
| if any(word in goal_keywords for word in ["knowledge", "understand", "learn", "know"]): | |
| objectives.append(f"Analyze key concepts and principles of {course_topic.lower()}") | |
| if any(word in goal_keywords for word in ["improve", "enhance", "better", "increase"]): | |
| objectives.append(f"Implement strategies to improve {course_topic.lower()} outcomes") | |
| if any(word in goal_keywords for word in ["solve", "problem", "challenge", "issue"]): | |
| objectives.append(f"Evaluate and solve common {course_topic.lower()} challenges") | |
| # Add default objectives if none generated | |
| if not objectives: | |
| objectives = [ | |
| f"Apply {course_topic.lower()} best practices in real-world scenarios", | |
| f"Identify key success factors for {course_topic.lower()}", | |
| f"Create actionable plans for implementing {course_topic.lower()} strategies" | |
| ] | |
| return objectives[:4] # Limit to 4 objectives | |
| def generate_course_modules(course_topic, objectives, delivery_method): | |
| """Generate suggested course modules""" | |
| modules = [] | |
| # Always start with introduction | |
| modules.append({ | |
| "title": f"Introduction to {course_topic}", | |
| "duration": "30-45 minutes", | |
| "content": ["Course overview", "Learning objectives", "Participant introductions", "Setting expectations"] | |
| }) | |
| # Generate core modules based on objectives | |
| for i, objective in enumerate(objectives, 1): | |
| module_title = f"Module {i}: {objective.split(' ', 1)[1].title()}" | |
| modules.append({ | |
| "title": module_title, | |
| "duration": "60-90 minutes", | |
| "content": ["Theory and concepts", "Practical exercises", "Case studies", "Group discussions"] | |
| }) | |
| # Add application/wrap-up module | |
| if delivery_method in ["In-person workshop", "Virtual live session", "Blended learning"]: | |
| modules.append({ | |
| "title": "Application & Action Planning", | |
| "duration": "45-60 minutes", | |
| "content": ["Real-world application", "Action planning", "Next steps", "Resources and support"] | |
| }) | |
| return modules | |
| def calculate_readiness_score(inputs): | |
| """Calculate a readiness score based on how complete the inputs are""" | |
| score = 0 | |
| max_score = 100 | |
| # Core requirements (60 points) | |
| if inputs.get('course_topic'): score += 15 | |
| if inputs.get('target_audience'): score += 15 | |
| if inputs.get('learning_goals'): score += 15 | |
| if inputs.get('delivery_method'): score += 15 | |
| # Additional details (40 points) | |
| if inputs.get('available_content'): score += 10 | |
| if inputs.get('subject_matter_experts'): score += 10 | |
| if inputs.get('success_metrics'): score += 10 | |
| if inputs.get('timeline'): score += 5 | |
| if inputs.get('budget_range'): score += 5 | |
| return min(score, max_score) | |
| def generate_recommendations(inputs, readiness_score): | |
| """Generate personalized recommendations""" | |
| recommendations = [] | |
| if readiness_score < 60: | |
| recommendations.append("π― **Priority**: Define clearer learning objectives and success metrics to strengthen your course foundation.") | |
| if not inputs.get('subject_matter_experts'): | |
| recommendations.append("π₯ **Expert Input**: Consider engaging subject matter experts early to ensure content accuracy and relevance.") | |
| if inputs.get('delivery_method') == 'Self-paced online' and not inputs.get('available_content'): | |
| recommendations.append("π **Content Strategy**: Self-paced courses require substantial pre-existing content. Plan for content creation resources.") | |
| if inputs.get('target_audience') and 'manager' in inputs.get('target_audience', '').lower(): | |
| recommendations.append("β‘ **Manager Focus**: Consider shorter, action-oriented modules that respect managers' time constraints.") | |
| if inputs.get('delivery_method') == 'Microlearning series': | |
| recommendations.append("π± **Microlearning Tips**: Break content into 5-10 minute digestible chunks with clear takeaways.") | |
| if readiness_score >= 80: | |
| recommendations.append("π **Ready to Launch**: Your course outline is well-developed! Consider piloting with a small group first.") | |
| return recommendations | |
| # Main content | |
| col1, col2 = st.columns([1, 1]) | |
| with col1: | |
| st.markdown('<div class="custom-subheader">Course Planning Inputs</div>', unsafe_allow_html=True) | |
| # Core course information | |
| st.markdown("**π Core Course Information**") | |
| course_topic = st.text_input( | |
| "Course Topic/Subject", | |
| placeholder="e.g., Leadership Development, Data Analysis, Customer Service", | |
| help="What is the main subject or skill your course will cover?" | |
| ) | |
| target_audience = st.text_input( | |
| "Target Audience", | |
| placeholder="e.g., New managers, Sales team, Customer support representatives", | |
| help="Who are the learners? Be specific about their role, experience level, etc." | |
| ) | |
| learning_goals = st.text_area( | |
| "Learning Goals & Objectives", | |
| placeholder="e.g., Improve team communication skills, reduce customer complaints by 20%, increase productivity", | |
| height=100, | |
| help="What should participants be able to do after completing the course?" | |
| ) | |
| col_d1, col_d2 = st.columns(2) | |
| with col_d1: | |
| delivery_method = st.selectbox( | |
| "Preferred Delivery Method", | |
| ["In-person workshop", "Virtual live session", "Self-paced online", "Blended learning", "Microlearning series", "On-the-job training"], | |
| help="How do you want to deliver this training?" | |
| ) | |
| with col_d2: | |
| content_depth = st.selectbox( | |
| "Content Depth", | |
| ["Basic overview", "Intermediate depth", "Advanced/comprehensive", "Expert level"], | |
| index=1, | |
| help="How deep should the content go?" | |
| ) | |
| # Additional details in expandable section | |
| with st.expander("π Additional Planning Details", expanded=False): | |
| st.markdown('<div class="settings-section">', unsafe_allow_html=True) | |
| col_a1, col_a2 = st.columns(2) | |
| with col_a1: | |
| audience_size = st.selectbox( | |
| "Audience Size", | |
| ["Individual (1-on-1)", "Small team (5-15)", "Medium group (15-30)", "Large group (20+)"], | |
| index=1 | |
| ) | |
| timeline = st.selectbox( | |
| "Development Timeline", | |
| ["Rush (1-2 weeks)", "Standard (1-2 months)", "Extended (3-6 months)", "Long-term (6+ months)"], | |
| index=1 | |
| ) | |
| with col_a2: | |
| budget_range = st.selectbox( | |
| "Budget Range", | |
| ["Minimal budget", "Small budget ($1K-5K)", "Medium budget ($5K-20K)", "Large budget ($20K+)", "Not specified"], | |
| index=4 | |
| ) | |
| priority_level = st.selectbox( | |
| "Priority Level", | |
| ["Low priority", "Medium priority", "High priority", "Critical/urgent"], | |
| index=2 | |
| ) | |
| available_content = st.text_area( | |
| "Available Content & Resources", | |
| placeholder="e.g., Existing presentations, documentation, videos, previous training materials", | |
| height=75, | |
| help="What materials do you already have that could be used or adapted?" | |
| ) | |
| subject_matter_experts = st.text_input( | |
| "Subject Matter Experts Available", | |
| placeholder="e.g., John Smith (Sales Director), external consultant, internal team leads", | |
| help="Who can provide expertise and content validation?" | |
| ) | |
| success_metrics = st.text_area( | |
| "Success Metrics & Evaluation", | |
| placeholder="e.g., Participant satisfaction scores, skill assessments, behavior change metrics, business impact", | |
| height=75, | |
| help="How will you measure if the training was successful?" | |
| ) | |
| st.markdown('</div>', unsafe_allow_html=True) | |
| # Example scenarios for inspiration | |
| with st.expander("Need inspiration? View example training scenarios", expanded=False): | |
| st.markdown('<div class="examples-section">', unsafe_allow_html=True) | |
| example_scenarios = [ | |
| { | |
| "title": "New Manager Leadership Program", | |
| "topic": "Leadership Fundamentals", | |
| "audience": "Newly promoted managers", | |
| "goals": "Develop core leadership skills, improve team management, increase employee engagement scores by 15%" | |
| }, | |
| { | |
| "title": "Customer Service Excellence", | |
| "topic": "Advanced Customer Service Skills", | |
| "audience": "Customer support representatives", | |
| "goals": "Reduce customer complaints by 25%, improve satisfaction ratings, handle difficult situations confidently" | |
| }, | |
| { | |
| "title": "Data-Driven Decision Making", | |
| "topic": "Business Analytics and Data Interpretation", | |
| "audience": "Department managers and analysts", | |
| "goals": "Make better decisions using data, create meaningful reports, identify key performance indicators" | |
| }, | |
| { | |
| "title": "Remote Team Management", | |
| "topic": "Managing Virtual Teams", | |
| "audience": "Team leaders and managers", | |
| "goals": "Improve virtual team productivity, enhance remote communication, maintain team culture" | |
| } | |
| ] | |
| for i, example in enumerate(example_scenarios): | |
| if st.button(f"Use Example: {example['title']}", key=f"example_{i}"): | |
| st.session_state["example_data"] = example | |
| st.rerun() | |
| st.markdown('</div>', unsafe_allow_html=True) | |
| # Apply example data if selected | |
| if "example_data" in st.session_state: | |
| example = st.session_state["example_data"] | |
| course_topic = example["topic"] | |
| target_audience = example["audience"] | |
| learning_goals = example["goals"] | |
| del st.session_state["example_data"] | |
| # Generate outline button | |
| generate_button = st.button( | |
| "π Generate Course Outline", | |
| disabled=not course_topic or not target_audience or not learning_goals, | |
| use_container_width=True | |
| ) | |
| if not course_topic or not target_audience or not learning_goals: | |
| st.info("Please fill in the core course information (topic, audience, and goals) to generate an outline") | |
| # Display generated outline | |
| with col2: | |
| st.markdown('<div class="custom-subheader">Generated Course Outline</div>', unsafe_allow_html=True) | |
| if generate_button and course_topic and target_audience and learning_goals: | |
| with st.spinner("Creating your course outline..."): | |
| # Simulate processing time | |
| time.sleep(1) | |
| # Collect all inputs | |
| course_inputs = { | |
| 'course_topic': course_topic, | |
| 'target_audience': target_audience, | |
| 'learning_goals': learning_goals, | |
| 'delivery_method': delivery_method, | |
| 'content_depth': content_depth, | |
| 'audience_size': audience_size if 'audience_size' in locals() else 'Medium group (15-30)', | |
| 'timeline': timeline if 'timeline' in locals() else 'Standard (1-2 months)', | |
| 'budget_range': budget_range if 'budget_range' in locals() else 'Not specified', | |
| 'priority_level': priority_level if 'priority_level' in locals() else 'Medium priority', | |
| 'available_content': available_content if 'available_content' in locals() else '', | |
| 'subject_matter_experts': subject_matter_experts if 'subject_matter_experts' in locals() else '', | |
| 'success_metrics': success_metrics if 'success_metrics' in locals() else '' | |
| } | |
| # Generate course outline components | |
| estimated_duration = calculate_estimated_duration(delivery_method, content_depth, course_inputs['audience_size']) | |
| learning_objectives = generate_learning_objectives(course_topic, target_audience, learning_goals) | |
| course_modules = generate_course_modules(course_topic, learning_objectives, delivery_method) | |
| readiness_score = calculate_readiness_score(course_inputs) | |
| recommendations = generate_recommendations(course_inputs, readiness_score) | |
| outline_data = { | |
| 'inputs': course_inputs, | |
| 'estimated_duration': estimated_duration, | |
| 'learning_objectives': learning_objectives, | |
| 'course_modules': course_modules, | |
| 'readiness_score': readiness_score, | |
| 'recommendations': recommendations, | |
| 'generated_date': datetime.now().strftime("%Y-%m-%d %H:%M") | |
| } | |
| st.session_state["generated_outline"] = outline_data | |
| # Add to history | |
| if outline_data not in st.session_state["course_history"]: | |
| st.session_state["course_history"].insert(0, outline_data) | |
| st.session_state["course_history"] = st.session_state["course_history"][:5] # Keep last 5 | |
| st.success("β Course outline generated successfully!") | |
| if st.session_state["generated_outline"] is not None: | |
| outline = st.session_state["generated_outline"] | |
| st.markdown('<div class="generated-outline">', unsafe_allow_html=True) | |
| # Course Overview Section | |
| st.markdown("### π Course Overview") | |
| st.markdown(f"**Course Title:** {outline['inputs']['course_topic']}") | |
| st.markdown(f"**Target Audience:** {outline['inputs']['target_audience']}") | |
| st.markdown(f"**Delivery Method:** {outline['inputs']['delivery_method']}") | |
| st.markdown(f"**Estimated Duration:** {outline['estimated_duration']} hours") | |
| # Readiness Score | |
| score_color = "green" if outline['readiness_score'] >= 80 else "orange" if outline['readiness_score'] >= 60 else "red" | |
| st.markdown(f""" | |
| <div class="success-indicator"> | |
| <strong>Course Readiness Score: <span style="color: {score_color};">{outline['readiness_score']}/100</span></strong> | |
| <br><small>Based on completeness of planning inputs</small> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # Learning Objectives | |
| st.markdown("### π― Learning Objectives") | |
| st.markdown("Upon completion, participants will be able to:") | |
| for i, objective in enumerate(outline['learning_objectives'], 1): | |
| st.markdown(f"{i}. {objective.capitalize()}") | |
| # Course Modules | |
| st.markdown("### π Proposed Course Structure") | |
| for i, module in enumerate(outline['course_modules'], 1): | |
| st.markdown(f""" | |
| <div class="outline-section"> | |
| <strong>{module['title']}</strong> ({module['duration']}) | |
| <ul> | |
| {"".join([f"<li>{item}</li>" for item in module['content']])} | |
| </ul> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # Success Metrics | |
| if outline['inputs']['success_metrics']: | |
| st.markdown("### π Success Metrics") | |
| st.markdown(outline['inputs']['success_metrics']) | |
| # Recommendations | |
| if outline['recommendations']: | |
| st.markdown("### π‘ Recommendations & Next Steps") | |
| for rec in outline['recommendations']: | |
| st.markdown(f""" | |
| <div class="recommendation"> | |
| {rec} | |
| </div> | |
| """, unsafe_allow_html=True) | |
| st.markdown('</div>', unsafe_allow_html=True) | |
| # Action buttons | |
| col_b1, col_b2 = st.columns(2) | |
| with col_b1: | |
| # Download as JSON | |
| outline_json = json.dumps(outline, indent=2) | |
| st.download_button( | |
| label="πΎ Download Outline", | |
| data=outline_json, | |
| file_name=f"course_outline_{int(time.time())}.json", | |
| mime="application/json", | |
| use_container_width=True | |
| ) | |
| with col_b2: | |
| # Regenerate button | |
| if st.button("π Refine Outline", use_container_width=True): | |
| with st.spinner("Refining course outline..."): | |
| time.sleep(1) | |
| # Regenerate with slight variations | |
| learning_objectives = generate_learning_objectives(course_topic, target_audience, learning_goals) | |
| course_modules = generate_course_modules(course_topic, learning_objectives, delivery_method) | |
| outline['learning_objectives'] = learning_objectives | |
| outline['course_modules'] = course_modules | |
| st.session_state["generated_outline"] = outline | |
| st.success("β Outline refined!") | |
| st.rerun() | |
| # Partnership CTA | |
| st.markdown(""" | |
| <div class="partnership-cta"> | |
| <h3>π Ready to Bring Your Course to Life?</h3> | |
| <p>This outline is just the beginning! Partner with our team to transform your vision into a comprehensive, engaging training program that delivers real results.</p> | |
| <p><strong>Next Steps:</strong> Content development β’ Instructional design β’ Learning technology β’ Delivery support</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| else: | |
| # Placeholder | |
| st.markdown(""" | |
| <div class="placeholder-area"> | |
| <h3>π Your Course Outline Will Appear Here</h3> | |
| <p>Fill in the course planning details and click 'Generate Course Outline' to see your structured training plan.</p> | |
| <br> | |
| <p><strong>Your outline will include:</strong></p> | |
| <p>β Learning objectives<br> | |
| β Course structure & modules<br> | |
| β Estimated duration<br> | |
| β Readiness assessment<br> | |
| β Personalized recommendations</p> | |
| </div> | |
| """, unsafe_allow_html=True) | |
| # Footer | |
| st.markdown(""" | |
| <div class="footnote"> | |
| <p><strong>About this tool:</strong> The Training Course Outline Generator helps L&D professionals structure their training ideas into actionable plans. Generated outlines provide a foundation for course development and can be customized based on your specific organizational needs.</p> | |
| </div> | |
| """, unsafe_allow_html=True) |