import gradio as gr
from transformers import pipeline
import re
from bs4 import BeautifulSoup
import requests
import random
# --- 1. Function to Scrape Curriculum Standards ---
def scrape_curriculum_standards(grade_level, subject, topic):
"""
Scrapes relevant curriculum standards from the provided sources based on grade, subject, and topic.
This is a simplified example; a real implementation would involve more sophisticated scraping and parsing.
"""
# Dummy data - Replace with actual scraping logic and data
# Note: Real scraping would require identifying the correct URLs,
# fetching the HTML, and parsing it with BeautifulSoup to find the relevant
# standards. This is *highly* dependent on the structure of the target websites.
# The code below is a placeholder.
if grade_level == "4" and subject == "Mathematik" and topic == "Gewicht":
return [
"Bildungsplan BW, Mathematik, Grundschule, 2. Klasse, Abschnitt 3.1, Unterabschnitt 3.1.2, Punkt 3.1.2.2, page 29 - 'Zahlenraum bis 100'",
"Thüringer Lehrplan, Mathematik, Grundschule, 2. Klasse, Bereich 2.1, Unterbereich 2.1.1, Punkt 2.1.1.3, page 15 - 'Zählen und Zahlendarstellung'",
]
elif grade_level == "4" and subject == "Mathematik" and topic == "Addition": # Example 2
return [
"Bildungsplan BW, Mathematik, Grundschule, Abschnitt 2.2, Unterabschnitt 2.2.1, Punkt 2.2.1.1, page 12 - 'Addition bis 100'",
"Thüringer Lehrplan, Mathematik, Grundschule, Bereich 1.2, Unterbereich 1.2.3, Punkt 1.2.3.2, page 18 - 'Addition im Zahlenraum bis 100'",
]
else:
return [] # Return an empty list if no standards are found
# --- 2. Function to Generate Lesson Plan Text (Core Logic) ---
def generate_lesson_plan(grade_level, subject, topic, class_duration, language="bosnian"):
"""
Generates a lesson plan based on the chatbot script's requirements and user input.
This is the core function where the detailed lesson plan generation logic goes.
It should integrate gamification, real-world examples, and other elements based on the chatbot script.
"""
# --- Helper Functions for Content Generation ---
def generate_introduction(topic, language):
introductions = {
("bosnian", "Gewicht"): "Dobrodošli na čas o težini! Danas ćemo istražiti različite jedinice težine i kako ih pretvoriti.",
("bosnian", "Addition"): "Danas ćemo vježbati zbrajanje! Naučit ćemo nove strategije za rješavanje zadataka zbrajanja.",
("german", "Gewicht"): "Willkommen zur Stunde über Gewicht! Heute werden wir verschiedene Gewichtseinheiten erforschen und wie man sie umrechnet.",
("german", "Addition"): "Heute üben wir das Addieren! Wir lernen neue Strategien, um Additionsaufgaben zu lösen.",
("english", "Gewicht"): "Welcome to the lesson on weight! Today, we will explore different units of weight and how to convert them.",
("english", "Addition"): "Today, we are going to practice addition! We will learn new strategies for solving addition problems."
}
default_introduction = "Introduction to the topic. This is where you'd provide a brief overview tailored to the subject." # Fallback
return introductions.get((language, topic), default_introduction)
def generate_main_activities(topic, language):
activities = {
("bosnian", "Gewicht"): "1. Rad na zadacima: Izračunajte težinu različitih predmeta. 2. Grupna aktivnost: Pogađanje težine (dajte djeci predmete da pogađaju koliko su teški). 3. Superar Aktivnost: Uključi Superar aktivnost vezanu za mjerenje.",
("bosnian", "Addition"): "1. Radni list: Riješite zadatke zbrajanja. 2. Igra: Zbrajanje s kockicama. 3. Superar Aktivnost: Uključi Superar aktivnost za zbrajanje.",
("german", "Gewicht"): "1. Aufgaben: Berechne das Gewicht verschiedener Objekte. 2. Gruppenaktivität: Gewichte schätzen (die Kinder schätzen lassen, wie schwer Gegenstände sind). 3. Superar Aktivität: Eine Superar Aktivität zum Messen einbeziehen.",
("german", "Addition"): "1. Arbeitsblatt: Löse Additionsaufgaben. 2. Spiel: Addieren mit Würfeln. 3. Superar Aktivität: Eine Superar Aktivität zum Addieren einbeziehen.",
("english", "Gewicht"): "1. Worksheet: Calculate the weight of different objects. 2. Group Activity: Weight guessing (give children objects and have them guess their weight). 3. Superar Activity: Include a Superar activity related to measurement.",
("english", "Addition"): "1. Worksheet: Solve addition problems. 2. Game: Addition with dice. 3. Superar Activity: Include a Superar activity on addition."
}
default_activities = "Main activities for the lesson."
return activities.get((language, topic), default_activities)
def generate_closure(topic, language):
closures = {
("bosnian", "Gewicht"): "1. Diskusija: Što smo naučili o težini? 2. Kviz: Brzi kviz o težini.",
("bosnian", "Addition"): "1. Pregled: Ponovimo strategije zbrajanja. 2. Završi s brzom igrom zbrajanja.",
("german", "Gewicht"): "1. Diskussion: Was haben wir über Gewicht gelernt? 2. Quiz: Ein schnelles Quiz zum Thema Gewicht.",
("german", "Addition"): "1. Wiederholung: Wiederholen wir die Additionsstrategien. 2. Beenden Sie mit einem schnellen Additionsspiel.",
("english", "Gewicht"): "1. Discussion: What did we learn about weight? 2. Quiz: A quick quiz about weight.",
("english", "Addition"): "1. Review: Let's review addition strategies. 2. End with a quick addition game."
}
default_closure = "Closure activities for the lesson."
return closures.get((language, topic), default_closure)
def generate_differentiation(language):
differentiation_strategies = {
"bosnian": "Za početnike: Dajte im jednostavnije zadatke. Za napredne: Dajte im izazovnije zadatke.",
"german": "Für Anfänger: Gib ihnen einfachere Aufgaben. Für Fortgeschrittene: Gib ihnen anspruchsvollere Aufgaben.",
"english": "For beginners: Give them simpler tasks. For advanced students: Give them more challenging tasks.",
}
return differentiation_strategies.get(language, "Differentiation strategies.") # Default fallback
def generate_multilingual_support(topic, language):
glossary = {
("bosnian", "Gewicht"): "Težina (Weight), Kilogram (Kilogram), Gram (Gram)",
("bosnian", "Addition"): "Zbrajanje (Addition), Plus (Plus), Zbroj (Sum)",
("german", "Gewicht"): "Gewicht (Weight), Kilogramm (Kilogram), Gramm (Gram)",
("german", "Addition"): "Addition (Addition), Plus (Plus), Summe (Sum)",
("english", "Gewicht"): "Weight (Težina), Kilogram (Kilogram), Gram (Gram)",
("english", "Addition"): "Addition (Zbrajanje), Plus (Plus), Sum",
}
return glossary.get((language, topic), "Multilingual support details.")
def generate_real_world_examples(topic, language):
examples = {
("bosnian", "Gewicht"): [
"Primjer 1: Izmjerite težinu jabuke pomoću vage. Usporedite s drugom voćkom.",
"Primjer 2: Procijenite koliko je težak školski ruksak, a zatim ga izvažite.",
"Primjer 3: Upotrijebite kulinarsku vagu za mjerenje sastojaka u receptu.",
"Primjer 4: Usporedite težinu boce vode i soka.",
"Primjer 5: Izračunajte ukupnu težinu svih učenikovih knjiga."
],
("bosnian", "Addition"): [
"Primjer 1: Ako imate 3 olovke i dobijete još 2, koliko imate olovaka?",
"Primjer 2: U košarici su 5 jabuka, a dodate još 4. Koliko je ukupno jabuka?",
"Primjer 3: Izračunajte ukupnu cijenu 2 čokolade i 3 bombona.",
"Primjer 4: Zbrojite broj učenika u dva odjeljenja.",
"Primjer 5: Ako pročitate 10 stranica knjige danas i 15 sutra, koliko ste stranica pročitali?"
],
("german", "Gewicht"): [
"Beispiel 1: Wiegen Sie einen Apfel mit einer Waage. Vergleichen Sie ihn mit einem anderen Obst.",
"Beispiel 2: Schätzen Sie, wie schwer ein Schulrucksack ist, und wiegen Sie ihn dann.",
"Beispiel 3: Verwenden Sie eine Küchenwaage, um die Zutaten in einem Rezept abzumessen.",
"Beispiel 4: Vergleichen Sie das Gewicht einer Wasserflasche und eines Saftes.",
"Beispiel 5: Berechnen Sie das Gesamtgewicht aller Bücher eines Schülers."
],
("german", "Addition"): [
"Beispiel 1: Wenn Sie 3 Stifte haben und noch 2 bekommen, wie viele Stifte haben Sie?",
"Beispiel 2: In einem Korb sind 5 Äpfel, und Sie fügen noch 4 hinzu. Wie viele Äpfel sind insgesamt?",
"Beispiel 3: Berechnen Sie den Gesamtpreis von 2 Schokoladen und 3 Bonbons.",
"Beispiel 4: Addieren Sie die Anzahl der Schüler in zwei Klassen.",
"Beispiel 5: Wenn Sie heute 10 Seiten eines Buches lesen und morgen 15, wie viele Seiten haben Sie gelesen?"
],
("english", "Gewicht"): [
"Example 1: Measure the weight of an apple using a scale. Compare it with another fruit.",
"Example 2: Estimate how heavy a school backpack is, and then weigh it.",
"Example 3: Use a kitchen scale to measure ingredients in a recipe.",
"Example 4: Compare the weight of a bottle of water and a juice.",
"Example 5: Calculate the total weight of all of a student's books."
],
("english", "Addition"): [
"Example 1: If you have 3 pencils and get 2 more, how many pencils do you have?",
"Example 2: There are 5 apples in a basket, and you add 4 more. What is the total number of apples?",
"Example 3: Calculate the total price of 2 chocolates and 3 candies.",
"Example 4: Add the number of students in two classes.",
"Example 5: If you read 10 pages of a book today and 15 tomorrow, how many pages have you read?"
],
}
return examples.get((language, topic), ["Real-world example"]) # Default if not found
def generate_teacher_notes_and_ideas(topic, language):
notes = {
("bosnian", "Gewicht"): [
"Bilješka 1: Poticati učenike da koriste različite jedinice težine.",
"Bilješka 2: Organizirajte praktične aktivnosti s vagama i predmetima.",
"Bilješka 3: Uključite vizualne materijale, poput slika vaga i predmeta.",
"Bilješka 4: Dajte učenicima priliku da procijene težinu predmeta prije vaganja.",
"Bilješka 5: Upotrijebite igre ili natjecanja kako biste održali angažman."
],
("bosnian", "Addition"): [
"Bilješka 1: Koristite vizualne materijale (kockice, predmeti) za ilustraciju zbrajanja.",
"Bilješka 2: Ohrabrujte učenike da koriste različite strategije zbrajanja.",
"Bilješka 3: Uključite praktične zadatke zbrajanja u svakodnevne situacije.",
"Bilješka 4: Pružite dodatnu praksu učenicima koji se bore.",
"Bilješka 5: Koristite igre i aktivnosti kako biste zbrajanje učinili zabavnim."
],
("german", "Gewicht"): [
"Hinweis 1: Ermutigen Sie die Schüler, verschiedene Gewichtseinheiten zu verwenden.",
"Hinweis 2: Organisieren Sie praktische Aktivitäten mit Waagen und Objekten.",
"Hinweis 3: Beziehen Sie visuelle Materialien wie Bilder von Waagen und Objekten ein.",
"Hinweis 4: Geben Sie den Schülern die Möglichkeit, das Gewicht von Objekten vor dem Wiegen zu schätzen.",
"Hinweis 5: Verwenden Sie Spiele oder Wettbewerbe, um das Engagement aufrechtzuerhalten."
],
("german", "Addition"): [
"Hinweis 1: Verwenden Sie visuelle Materialien (Würfel, Objekte), um das Addieren zu veranschaulichen.",
"Hinweis 2: Ermutigen Sie die Schüler, verschiedene Additionsstrategien zu verwenden.",
"Hinweis 3: Integrieren Sie praktische Additionsaufgaben in Alltagssituationen.",
"Hinweis 4: Bieten Sie Schülern, die Schwierigkeiten haben, zusätzliche Übung.",
"Hinweis 5: Verwenden Sie Spiele und Aktivitäten, um das Addieren unterhaltsam zu gestalten."
],
("english", "Gewicht"): [
"Note 1: Encourage students to use different units of weight.",
"Note 2: Organize practical activities with scales and objects.",
"Note 3: Include visual materials, such as pictures of scales and objects.",
"Note 4: Give students the opportunity to estimate the weight of objects before weighing them.",
"Note 5: Use games or competitions to maintain engagement."
],
("english", "Addition"): [
"Note 1: Use visual materials (cubes, objects) to illustrate addition.",
"Note 2: Encourage students to use different addition strategies.",
"Note 3: Include practical addition tasks in everyday situations.",
"Note 4: Provide extra practice for students who are struggling.",
"Note 5: Use games and activities to make addition fun."
],
}
return notes.get((language, topic), ["Teacher's Note"]) # Default if not found
def generate_gamification_element(topic, language):
gamification_ideas = {
("bosnian", "Gewicht"): [
("Superar Aktivnost:", "Uključite Superar aktivnost vezanu za mjerenje težine."),
("Izazov:", "Neka djeca sudjeluju u izazovu: Tko može najpreciznije procijeniti težinu predmeta?")
],
("bosnian", "Addition"): [
("Superar Aktivnost:", "Uključite Superar aktivnost vezanu za zbrajanje."),
("Kviz:", "Napravite kviz za zbrajanje.")
],
("german", "Gewicht"): [
("Superar-Aktivität:", "Integrieren Sie eine Superar-Aktivität zum Thema Gewichte."),
("Herausforderung:", "Fordern Sie die Kinder heraus: Wer kann das Gewicht eines Gegenstandes am genauesten schätzen?")
],
("german", "Addition"): [
("Superar-Aktivität:", "Integrieren Sie eine Superar-Aktivität zum Thema Addition."),
("Quiz:", "Erstellen Sie ein Quiz zum Thema Addition.")
],
("english", "Gewicht"): [
("Superar Activity:", "Include a Superar activity related to measuring weight."),
("Challenge:", "Have the children participate in a challenge: Who can estimate the weight of an object most accurately?")
],
("english", "Addition"): [
("Superar Activity:", "Include a Superar activity related to addition."),
("Quiz:", "Create an addition quiz."),
],
}
elements = gamification_ideas.get((language, topic), [("Gamification Idea", "Gamification Description")])
return random.choice(elements)
# --- 3. Create the lesson plan string ---
lesson_plan = f"""
**P.U. Internationale Deutsche Schule Sarajevo – Međunarodna Njemačka Škola Sarajevo (IDSS)**
**Address:** Buka 13, 71000 Sarajevo, Bosnia and Herzegovina
**Phone:** +387 33 560 520
**Email:** info@idss.ba
**Website:** www.idss.edu.ba
**Teacher Information:**
**Date:** Format: DD.MM.YYYY
**Teacher's Name:**
**Basic Lesson Information**
**Grade Level (class/Klasse):** {grade_level}
**Subject (predmet/Fach):** {subject}
**Topic (teaching unit/Theme):** {topic}
**Class Duration (Klassendauer):** {class_duration} min
## Basic Information (Font Century Gothic 22pt)
**School:** IDSS (Font Century Gothic 11pt)
**Subject:** *{subject}* (Font Century Gothic 11pt)
**Topic:** *[Generated Topic and Subtopics w/ Bildungsplan ref. codes]* (Font Century Gothic 11pt)
**Lesson Type:** *[Generated Lesson Type]* (Font Century Gothic 11pt)
**STANDARDS:** *[Generated Curriculum Standards with full reference as described in instruction #6]* (Font Century Gothic 11pt)
## Didactic Details (Font Century Gothic 22pt)
**Goal:** *[Generated Lesson Goal]* (Font Century Gothic 11pt)
**Learning Outcomes:** *[Generated Learning Outcomes]* (Font Century Gothic 11pt)
**Teaching Methods:** *[Generated Teaching Methods]* (Font Century Gothic 11pt)
**Teaching Aids:** *[Generated Teaching Aids]* (Font Century Gothic 11pt)
**Correlations:** *[Generated Cross-curricular Correlations]* (Font Century Gothic 11pt)
## Lesson Execution (Font Century Gothic 22pt)
### Introduction (Font Century Gothic 11pt, bold)
{generate_introduction(topic, language)}
*[Generated Introduction Activities with optional gamification suggestions]* (Font Century Gothic 11pt)
### Main Activities (Font Century Gothic 11pt, bold)
{generate_main_activities(topic, language)}
*[Generated Main Activities with optional gamification suggestions]* (Font Century Gothic 11pt)
### Closure (Font Century Gothic 11pt, bold)
{generate_closure(topic, language)}
*[Generated Closure Activities with optional gamification suggestions]* (Font Century Gothic 11pt)
## Differentiation (Font Century Gothic 22pt)
*[Generated Differentiation Strategies for beginner and advanced learners]* (Font Century Gothic 11pt)
{generate_differentiation(language)}
## Multilingual Support (Font Century Gothic 22pt)
*[Generated Multilingual Strategies and Glossary]* (Font Century Gothic 11pt)
{generate_multilingual_support(topic, language)}
## Evaluation (Font Century Gothic 22pt)
### Assessment Criteria (Font Century Gothic 11pt, bold)
*[Generated Assessment Criteria]* (Font Century Gothic 11pt)
### Reflection for Students (Font Century Gothic 11pt, bold)
*[Generated Student Reflection Prompts]* (Font Century Gothic 11pt)
### Teacher Reflection (Font Century Gothic 11pt, bold)
*[Generated Teacher Reflection Prompts]* (Font Century Gothic 11pt)
## Gamification Elements (Font Century Gothic 22pt)
*[Generated Gamification Suggestions - summarizing the gamification elements used in the lesson with explanations and instructions]* (Font Century Gothic 11pt)
{
element_type, element_description
}
## Resources (Font Century Gothic 22pt)
### Textbooks (Font Century Gothic 11pt, bold)
*[Generated Textbook List with full bibliographic information and working purchase links]* (Font Century Gothic 11pt)
### Additional Materials (Font Century Gothic 11pt, bold)
*[Generated Additional Material List with descriptions and links where applicable]* (Font Century Gothic 11pt)
### Supplementary Sources (Font Century Gothic 11pt, bold)
*[Generated Supplementary Sources - at least 5 reliable online resources for teacher preparation, including direct links to curriculum documents with descriptions]* (Font Century Gothic 11pt)
## Documentation (Font Century Gothic 22pt)
### Progress Tracking (Font Century Gothic 11pt, bold)
*[Generated Progress Tracking Methods]* (Font Century Gothic 11pt)
### Portfolio (Font Century Gothic 11pt, bold)
*[Generated Portfolio Guidelines]* (Font Century Gothic 11pt)
### Digital Records (Font Century Gothic 11pt, bold)
*[Generated Digital Record Instructions]* (Font Century Gothic 11pt)
## Real-World Examples (Font Century Gothic 22pt)
*[At least 5 Generated Real-World Examples with detail and links]* (Font Century Gothic 11pt)
"""
for i, example in enumerate(generate_real_world_examples(topic, language)):
lesson_plan += f"Example {i+1}: {example}
"
lesson_plan += "
" # Add a blank line
## Teacher's Notes and Ideas
lesson_plan += """
## Teacher's Notes and Ideas (Font Century Gothic 22pt)
*[At least 5 Generated Teacher Notes with detail]* (Font Century Gothic 11pt)
"""
for i, note in enumerate(generate_teacher_notes_and_ideas(topic, language)):
lesson_plan += f"Note {i+1}: {note}
"
lesson_plan += """
## Flow Diagram (Font Century Gothic 22pt)
````flowchart LR
A[Start Lesson] --> B[Introduction with Optional Gamification]
B --> C [Teacher-Led Activity]
C --> D[Student Participation]
D --> E[Main Activity with Optional Gamification]
E --> F[Use of Resources]
F --> G[Group Work or Discussion]
G --> H[Closure with Optional Gamification]
H --> I[Reflection and Assessment]
I --> J[End Lesson]
Use code with caution.
Python
Illustrative Story: (Font Century Gothic 22pt)
[Generated Illustrative Story (200-500 words)] (Font Century Gothic 11pt)
Image Links and Captions: (Font Century Gothic 22pt)
Image 1: [URL of Image 1] - [Caption for Image 1) (Font Century Gothic 11pt)
Image 2: [URL of Image 2] - [Caption for Image 2] (Font Century Gothic 11pt)
Image 3: [URL of Image 3] - [Caption for Image 3) (Font Century Gothic 11pt)
"""
# --- Integrate Curriculum Standards ---
standards = scrape_curriculum_standards(grade_level, subject, topic)
if standards:
lesson_plan = lesson_plan.replace("*[Generated Curriculum Standards with full reference as described in instruction #6]*", "\n".join(f" * {s}" for s in standards))
else:
lesson_plan = lesson_plan.replace("*[Generated Curriculum Standards with full reference as described in instruction #6]*", "Curriculum standards not found for this combination of grade, subject, and topic.")
# --- Text Generation and Customization ---
# You will need to implement much more sophisticated generation logic here.
lesson_plan = lesson_plan.replace("*[Generated Topic and Subtopics w/ Bildungsplan ref. codes]*", topic)
lesson_plan = lesson_plan.replace("*[Generated Lesson Type]*", "Example Lesson Type - Customize This")
lesson_plan = lesson_plan.replace("*[Generated Lesson Goal]*", f"Students will understand the key concepts of {topic}.")
lesson_plan = lesson_plan.replace("*[Generated Learning Outcomes]*", f"Students will be able to apply {topic} in practical scenarios. Students will be able to explain the process of {topic}.")
lesson_plan = lesson_plan.replace("*[Generated Teaching Methods]*", "Discussion, Activities, Group Work") # Adapt these
lesson_plan = lesson_plan.replace("*[Generated Teaching Aids]*", "Whiteboard, Markers, Worksheets, Scales") # Add details
lesson_plan = lesson_plan.replace("*[Generated Cross-curricular Correlations]*", "Mathematics, Science, Language Arts") # Add these
lesson_plan = lesson_plan.replace("*[Generated Assessment Criteria]*", "Participation, Worksheet Completion, Quiz Score")
lesson_plan = lesson_plan.replace("*[Generated Student Reflection Prompts]*", f"What did you learn about {topic} today?")
lesson_plan = lesson_plan.replace("*[Generated Teacher Reflection Prompts]*", "What went well in this lesson? How could I improve the activities?")
lesson_plan = lesson_plan.replace("*[Generated Textbook List with full bibliographic information and working purchase links]*", "No textbooks found at this time.") # Implement textbook recommendation logic
lesson_plan = lesson_plan.replace("*[Generated Additional Material List with descriptions and links where applicable]*", "Worksheets are available [link to worksheet].")
lesson_plan = lesson_plan.replace("*[Generated Progress Tracking Methods]*", "Observe student participation, review worksheets, and assess quiz scores.")
lesson_plan = lesson_plan.replace("*[Generated Portfolio Guidelines]*", "Students should submit the worksheets and any additional notes from the activities.")
lesson_plan = lesson_plan.replace("*[Generated Digital Record Instructions]*", "Keep a record of the students' worksheet and quiz scores.")
element_type, element_description = generate_gamification_element(topic, language)
lesson_plan = lesson_plan.replace("{ element_type, element_description\n}", f"{element_type} {element_description}")
lesson_plan = lesson_plan.replace("*[Generated Introduction Activities with optional gamification suggestions]*", "Begin with a brief introduction (as described above) and include a quick game to engage students.")
lesson_plan = lesson_plan.replace("*[Generated Main Activities with optional gamification suggestions]*", "Facilitate the main activities as described above. Integrate a game to test the knowledge.")
lesson_plan = lesson_plan.replace("*[Generated Closure Activities with optional gamification suggestions]*", "Conclude the lesson with a brief review quiz to assess understanding.")
# --- Illustrative Story (Placeholder) ---
lesson_plan = lesson_plan.replace("[Generated Illustrative Story (200-500 words)]", f"Once upon a time, in a classroom, students learned about {topic}...")
lesson_plan = lesson_plan.replace("[URL of Image 1]", "https://example.com/image1.jpg") # Replace with actual image links
lesson_plan = lesson_plan.replace("[Caption for Image 1)", "Image 1 caption")
lesson_plan = lesson_plan.replace("[URL of Image 2]", "https://example.com/image2.jpg")
lesson_plan = lesson_plan.replace("[Caption for Image 2]", "Image 2 caption")
lesson_plan = lesson_plan.replace("[URL of Image 3]", "https://example.com/image3.jpg")
lesson_plan = lesson_plan.replace("[Caption for Image 3]", "Image 3 caption")
return lesson_plan
with gr.Blocks() as demo:
gr.Markdown("# IDSS Lesson Planner")
with gr.Row():
with gr.Column():
grade_level = gr.Textbox(label="Grade Level (e.g., 4)", value="4")
subject = gr.Textbox(label="Subject (e.g., Mathematik)", value="Mathematik")
topic = gr.Textbox(label="Topic (e.g., Gewicht)", value="Gewicht")
class_duration = gr.Textbox(label="Class Duration (e.g., 45)", value="45")
language_dropdown = gr.Dropdown(choices=["bosnian", "german", "english"], label="Language", value="bosnian") # Add language selection
generate_button = gr.Button("Generate Lesson Plan")
with gr.Column():
output_text = gr.Textbox(label="Lesson Plan", lines=40) # Adjusted lines
generate_button.click(
fn=generate_lesson_plan,
inputs=[grade_level, subject, topic, class_duration, language_dropdown], # Include the language
outputs=output_text,
)
demo.launch()