import streamlit as st import json from openai_llm import LessonPlanGenerator # Page configuration st.set_page_config( page_title="WizLab Lesson Plan Generator", page_icon="📚", layout="wide" ) # Custom CSS with improved styling st.markdown(""" """, unsafe_allow_html=True) # Initialize generator #@st.cache_resource #def get_generator(): #return LessonPlanGenerator() generator = LessonPlanGenerator() # Header st.title("WizLab Lesson Plan Generator") st.markdown("We help you generate lesson plans tailored to your needs.") # Input section st.header("Input Your Requirements") # Create two columns for input fields col1, col2 = st.columns(2) with col1: topic = st.text_input("Topic", placeholder="e.g., Lesson Plan to teach Spanish numbers as third language to English Speaking students ") age_group_options = ["Elementary (6-11)", "Middle School (12-14)", "High School (15-18)", "Adult Learners", "Other"] age_group_selection = st.selectbox("Target Age Group", age_group_options) if age_group_selection == "Other": age_group = st.text_input("Specify Age Group") else: age_group = age_group_selection language_options = [ "English", "日本語 (Japanese)", "中文 (Mandarin Chinese)", "Español (Spanish)", "हिंदी (Hindi)", "한국어 (Korean)", "Deutsch (German)", "Français (French)", "Português (Portuguese)", "العربية (Arabic)", "Русский (Russian)", "Other" ] language_selection = st.selectbox("Select Output Language", language_options) LANGUAGE_MAPPING = { "日本語 (Japanese)": "Japanese", "中文 (Mandarin Chinese)": "Mandarin Chinese", "Español (Spanish)": "Spanish", "हिंदी (Hindi)": "Hindi", "한국어 (Korean)": "Korean", "Deutsch (German)": "German", "Français (French)": "French", "Português (Portuguese)": "Portuguese", "العربية (Arabic)": "Arabic", "Русский (Russian)": "Russian" } # Then in your language selection code: if language_selection == "Other": language = st.text_input("Specify Language") else: # Use mapping if available, otherwise use the base language name language = LANGUAGE_MAPPING.get(language_selection, language_selection) #if language_selection == "Other": # language = st.text_input("Specify Language") # else: # Extract the base language name without the native script # language = language_selection.split(" (")[0] if " (" in language_selection else language_selection with col2: #duration_options = ["30 minutes", "45 minutes", "60 minutes", "90 minutes", "Other"] #duration_selection = st.selectbox("Lesson Duration", duration_options) #if duration_selection == "Other": # duration = st.text_input("Specify Duration") #else: # duration = duration_selection duration = st.text_input("Duration [in minutes]", placeholder = "e.g., 25 minutes") proficiency_options = ["Beginner [A1]", "Elementary [A2]", "Intermediate[B1, B2]", "Advanced[C1]", "Proficient [C2]", "Other"] proficiency_selection = st.selectbox("Proficiency Level [CEFR]", proficiency_options) if proficiency_selection == "Other": proficiency = st.text_input("Specify Proficiency Level") else: proficiency = proficiency_selection tech_options = ["Interactive Whiteboard", "Computers/Laptops", "Mobile Devices", "Internet Access", "None", "Other"] tech_selection = st.multiselect("Accessible Tech Resources", tech_options) if "Other" in tech_selection: other_tech = st.text_input("Specify Other Technology Requirements") tech_usage = [tech for tech in tech_selection if tech != "Other"] + [other_tech] else: tech_usage = tech_selection def format_content(data): html_content = '