import gradio as gr from lesson_graph import LessonGraph # Instantiate the LessonGraph class lesson_graph = LessonGraph() # Gradio interface demo = gr.Blocks() with demo: gr.Markdown("# EduScape: Design Your Educational Landscape") gr.Markdown("Welcome to EduScape, where lesson planning becomes an adventure in crafting educational journeys. Design, visualize, and perfect your learning landscapes with ease.") with gr.Row(): teacher_name = gr.Textbox(label="Teacher Name (Required)", placeholder="Enter the teacher's full name", info="e.g., Sarah Johnson") school_board = gr.Textbox(label="School Board/Region (Optional)", placeholder="Enter the school board or region", info="e.g., Oakville District School Board") country_authority = gr.Textbox(label="Country Authority (Optional)", placeholder="Enter the country-level education authority", info="e.g., Ministry of Education") with gr.Row(): subject = gr.Textbox(label="Subject (Required)", placeholder="Enter the subject name", info="e.g., Earth Science") grade_level = gr.Textbox(label="Grade Level (Required)", placeholder="Enter the grade level", info="e.g., Grade 7") with gr.Row(): learning_objective = gr.Textbox(label="Learning Objective (Optional)", placeholder="Enter the main learning goal", info="e.g., Understand the water cycle and its impact on Earth's climate") activity = gr.Textbox(label="Activity (Optional)", placeholder="Enter the main class activity", info="e.g., Create a terrarium to model the water cycle") with gr.Row(): assessment = gr.Textbox(label="Assessment (Optional)", placeholder="Enter the assessment method", info="e.g., Group presentation on terrarium observations") resource = gr.Textbox(label="Resource/Material (Optional)", placeholder="Enter required resources", info="e.g., Terrarium kit, climate diagrams") with gr.Row(): generate_btn = gr.Button("Map Your Lesson Plan") graph_btn = gr.Button("Display Graph (JSON)") clear_btn = gr.Button("Clear Landscape") examples = [ ["Sarah Johnson", "Oakville District School Board", "Ministry of Education", "Earth Science", "Grade 7", "Understand the water cycle and its impact on Earth's climate", "Create a terrarium to model the water cycle", "Group presentation on terrarium observations", "Terrarium kit, climate diagrams"], ["Marek Nowak", "Warsaw School District", "Ministry of National Education of Poland", "Matematyka", "Klasa 2", "Zrozumienie podstawowych operacji matematycznych", "Rozwiązywanie prostych zadań tekstowych", "Praca grupowa nad rozwiązywaniem zadań", "Podręcznik, karty pracy, tablica interaktywna"], # Example 1: Grade IV - Natural Numbers (matches 1.1, 1.2) ["Anna Kowalska", "Kraków School District", "Ministry of National Education of Poland", "Matematyka", "Klasa IV", "Zapisywanie i odczytywanie liczb naturalnych wielocyfrowych oraz ich interpretacja na osi liczbowej", "Zaznaczanie i odczytywanie liczb na osi liczbowej oraz porównywanie liczb naturalnych", "Sprawdzian umiejętności odczytywania i porównywania liczb", "Oś liczbowa, karty z liczbami naturalnymi"], # Example 2: Grade V - Fractions (matches 5.1, 5.2) ["Piotr Wiśniewski", "Warsaw School District", "Ministry of National Education of Poland", "Matematyka", "Klasa V", "Dodawanie i odejmowanie ułamków dziesiętnych w pamięci i pisemnie", "Rozwiązywanie zadań z dodawaniem i odejmowaniem ułamków dziesiętnych w kontekście pieniędzy (zł, gr)", "Kartkówka z działań na ułamkach dziesiętnych", "Karty zadań, kalkulator (dla trudniejszych przykładów)"], # Example 3: Grade VII - Algebra (matches 3.1, 3.3) ["Maria Dąbrowska", "Gdańsk School District", "Ministry of National Education of Poland", "Matematyka", "Klasa VII", "Zapisywanie zależności przedstawionych w zadaniach w postaci wyrażeń algebraicznych", "Zapisywanie wyrażeń algebraicznych na podstawie informacji osadzonych w kontekście praktycznym", "Samodzielne układanie i rozwiązywanie zadań tekstowych z wyrażeniami algebraicznymi", "Karty zadań z wyrażeniami algebraicznymi"], # Example 4: Grade VIII - Geometry (matches 8.7) ["Tomasz Lewandowski", "Poznań School District", "Ministry of National Education of Poland", "Matematyka", "Klasa VIII", "Zastosowanie twierdzenia Pitagorasa w sytuacjach praktycznych", "Rozwiązywanie zadań wykorzystujących twierdzenie Pitagorasa w kontekście rzeczywistym", "Projekt praktyczny: wykorzystanie twierdzenia Pitagorasa w terenie", "Przyrządy pomiarowe, karty zadań z geometrii"], # Example 5: Grade VI - Statistics (matches 13.1, 13.2) ["Ewa Kamińska", "Wrocław School District", "Ministry of National Education of Poland", "Matematyka", "Klasa VI", "Odczytywanie i interpretowanie danych przedstawionych w tekstach, tabelach, na diagramach i wykresach", "Tworzenie diagramów słupkowych i kołowych oraz wykresów na podstawie zebranych danych", "Projekt: zbieranie danych klasowych i przedstawianie ich na różnych typach wykresów", "Papier milimetrowy, linijki, szablony do wykresów"], ["Maria Chen", "Calgary Public Schools", "Alberta Education", "Mathematics", "Grade 1", "Students interpret and explain quantity to 100", "Using base-10 blocks to represent two-digit numbers and practice skip counting by 5s and 10s", "Group counting assessment using manipulatives", "Base-10 blocks, number charts, counting frames"], ["David Thompson", "Edmonton Catholic Schools", "Alberta Education", "Mathematics", "Grade 3", "Analyze and apply strategies for multiplication and division within 100", "Create arrays using counters to model multiplication facts and explore the relationship between multiplication and division", "Small group problem-solving tasks involving real-world multiplication scenarios", "Counters, grid paper, multiplication tables"], ["Sarah Blackwater", "Siksika Nation School Board", "Alberta Education", "Mathematics", "Grade 4", "Apply place value to decimal numbers and relate fractions to decimals", "Using First Nations beading patterns to explore decimal numbers and fractions", "Create and explain patterns using decimals and fractions in cultural contexts", "Beading materials, decimal grids, number lines"], ["Ahmed Hassan", "Lethbridge School District", "Alberta Education", "Mathematics", "Grade 5", "Estimate and calculate area using standard units, investigate symmetry as a geometric property", "Creating and measuring geometric designs using square units and exploring symmetry in nature", "Project-based assessment: Design and measure a garden plot using standard units", "Grid paper, rulers, geometric shapes, nature specimens"], ["Lisa Running Rabbit", "Treaty 7 Education Authority", "Alberta Education", "Mathematics", "Grade 6", "Investigate magnitude with positive and negative numbers, explain location and movement in the Cartesian plane", "Using traditional games to explore positive and negative numbers, mapping traditional territories on coordinate plane", "Create and solve problems involving integers in real-world contexts", "Coordinate grid paper, traditional games materials, temperature charts"] ] gr.Examples( examples=examples, inputs=[teacher_name, school_board, country_authority, subject, grade_level, learning_objective, activity, assessment, resource] ) search_output = gr.Textbox(label="Content Discovery Search String", show_copy_button=True) graph_output = gr.Image(label="Your Educational Landscape") message_output = gr.Textbox(label="Landscape Status", show_copy_button=True) def handle_generate(teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority): try: search_string, image = lesson_graph.process_inputs( teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority ) return search_string, image, "Lesson plan mapped successfully!" except ValueError as e: return "", None, f"Error: {str(e)}. Please fill in all required fields." generate_btn.click( handle_generate, inputs=[teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority], outputs=[search_output, graph_output, message_output] ) graph_btn.click( lesson_graph.graph_to_json, outputs=[message_output] ) def handle_reset(): reset_state = lesson_graph.reset_state() return ( reset_state.teacher_name, reset_state.subject, reset_state.grade_level, reset_state.learning_objective, reset_state.activity, reset_state.assessment, reset_state.resource, reset_state.school_board, reset_state.country_authority, # Include the new field "", # Reset search_output None, # Reset graph_output reset_state.message ) clear_btn.click( handle_reset, outputs=[ teacher_name, subject, grade_level, learning_objective, activity, assessment, resource, school_board, country_authority, # Include the new field search_output, graph_output, message_output ] ) # Add Markdown section explaining the purpose and use of the app gr.Markdown(""" ## Purpose of EduScape: Understanding Lesson Plans as a Graph EduScape helps educators visualize lesson plans as a graph, where key lesson elements (teacher, subject, grade level, learning objectives, activities, assessments, and resources) are represented as nodes with logical relationships. This structure allows teachers to better understand the connections between different parts of their lessons, facilitating clearer planning and discovery of resources. ### Key Features: - **User Input-Driven Graph Construction**: Educators can input details like teacher name, subject, grade level, learning objective, activity, assessment, and resources to automatically construct a lesson plan graph. - **Graph Visualization**: Each element of the lesson plan is represented as a node, and the connections between these elements (like how an activity achieves the learning objective) are visualized through edges. - **Content Discovery**: The system generates a search string based on input, which can help the teacher discover content or resources to support their lesson plan. ### Required and Optional Fields: - **Required Fields**: Teacher Name, Subject, and Grade Level - **Optional Fields**: Learning Objective, Activity, Assessment, Resource/Material, and School Board/Region ### Logical Flow of the Knowledge Graph: 1. The **Teacher** node connects to the **Subject** node (representing what the teacher teaches). 2. The **Subject** node connects to the **Grade Level** (defining what is taught and to whom). 3. If provided, the **Learning Objective** node links to the **Subject** (showing what specific goal is covered). 4. If provided, the **Country Authority** node connects to the **Learning Objective** (indicating that the national authority defines the learning objectives). 5. If both are provided, the **Activity** node links to the **Learning Objective** (showing how the objective is achieved through student engagement). 6. If provided, the **Assessment** node connects to the **Learning Objective** (indicating how learning is evaluated). 7. If both are provided, the **Resource** node connects to the **Activity** (detailing what materials are needed for the activity). 8. If provided, the **Teacher** also connects to the **School Board** (showing which governing body the teacher belongs to). 9. If both are provided, the **Country Authority** node connects to the **School Board** (showing oversight from the national level). ### Example Use Case: A teacher, Sarah Johnson, inputs her lesson plan for Grade 7 Earth Science. She must provide her name, the subject, and the grade level. Optionally, she can add a learning objective about understanding the water cycle, an activity to create a terrarium, a group presentation for assessment, and specify resources like a terrarium kit. The system visualizes the relationships between these elements in the graph and generates a content discovery string to help her find additional resources. EduScape ensures that teachers can organize their lessons effectively while aligning with the curriculum and discovering resources to enhance their lesson delivery, with flexibility to include as much or as little detail as they prefer. """) gr.Markdown(""" --- """) gr.Markdown(""" ### License: CC BY-NC-SA 4.0 This project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. [Learn more](https://creativecommons.org/licenses/by-nc-sa/4.0/). """) # Launch the EduScape app demo.launch()