import streamlit as st
import json
import time
import random
# Set page config
st.set_page_config(
page_title="Training Content Format Discovery",
page_icon="🎓",
layout="wide",
initial_sidebar_state="collapsed"
)
# Custom CSS
st.markdown("""
""", unsafe_allow_html=True)
# Title and description
st.markdown("""
', unsafe_allow_html=True)
if generate_button and objectives and goals:
with st.spinner("Analyzing your requirements..."):
# Simulate processing time
time.sleep(1.5)
# Calculate scores
scores = calculate_format_scores(
audience_type, budget, objectives, goals, timeline, interaction_level, team_size
)
# Sort by score
sorted_formats = sorted(scores.items(), key=lambda x: x[1], reverse=True)
# Store recommendations
st.session_state["recommendations"] = {
"formats": sorted_formats,
"params": {
"audience": audience_type,
"budget": budget,
"timeline": timeline,
"objectives": objectives,
"goals": goals,
"interaction": interaction_level,
"team_size": team_size,
"context": additional_context
}
}
st.success("Analysis complete! Here are your recommendations:")
# Check if we have recommendations to display
if st.session_state["recommendations"] is not None:
recommendations = st.session_state["recommendations"]
# Personalized headline
st.markdown(f'
Recommended for {recommendations["params"]["audience"].lower()}:
', unsafe_allow_html=True)
# Show top 3 recommendations
for i, (format_id, score) in enumerate(recommendations["formats"][:3]):
format_data = TRAINING_FORMATS[format_id]
st.markdown('
', unsafe_allow_html=True)
# Expandable "View More Options" section
with st.expander("View More Options", expanded=False):
if len(recommendations["formats"]) > 3:
st.markdown("**Additional Recommendations:**")
for i, (format_id, score) in enumerate(recommendations["formats"][3:5], 4):
format_data = TRAINING_FORMATS[format_id]
st.markdown('
', unsafe_allow_html=True)
st.markdown(f'**{format_data["name"]}** ({score}% Match)')
st.markdown(f'{format_data["description"]}')
if "sample_link" in format_data:
st.markdown(f'
🔗 View Sample', unsafe_allow_html=True)
if "roi_metrics" in format_data:
st.markdown(f'
Expected Results: {format_data["roi_metrics"]}
', unsafe_allow_html=True)
st.markdown('
', unsafe_allow_html=True)
else:
st.markdown("*All relevant options are shown above.*")
# Grouped Action Buttons
st.markdown('
', unsafe_allow_html=True)
else:
# Show placeholder INSIDE the results container
st.markdown('''
🎯 Your Recommendations Will Appear Here
Complete the form and click "Get My Recommendations" to see your personalized training format suggestions.
''', unsafe_allow_html=True)
# Close the results container
st.markdown('
', unsafe_allow_html=True)
# Consultation CTA outside the results container - only show when no recommendations
if st.session_state["recommendations"] is None:
st.markdown('