Spaces:
Runtime error

File size: 26,608 Bytes
ce0b030
b978d6b
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
 
ce0b030
b978d6b
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b030
b978d6b
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b030
 
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dafb72c
 
b978d6b
 
 
 
 
 
 
 
 
ce0b030
b978d6b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922012f
 
b978d6b
a7cdad1
b978d6b
34255ff
 
 
b978d6b
 
 
 
 
 
 
 
 
 
 
 
ce0b030
dafb72c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
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
<br>
**Teacher Information:**
**Date:** Format: DD.MM.YYYY
**Teacher's Name:**
<br>
**Basic Lesson Information**
**Grade Level (class/Klasse):** {grade_level}
**Subject (predmet/Fach):** {subject}
**Topic (teaching unit/Theme):** {topic}
**Class Duration (Klassendauer):** {class_duration} min
<br>
## 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)
<br>
## 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)
<br>
## 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)
<br>
## Differentiation (Font Century Gothic 22pt)
*[Generated Differentiation Strategies for beginner and advanced learners]* (Font Century Gothic 11pt)
{generate_differentiation(language)}
<br>
## Multilingual Support (Font Century Gothic 22pt)
*[Generated Multilingual Strategies and Glossary]* (Font Century Gothic 11pt)
{generate_multilingual_support(topic, language)}
<br>
## 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)
<br>
## 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
}
<br>
## 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)
<br>
## 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)
<br>
## 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}<br>"

    lesson_plan += "<br>" # 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}<br>"

    lesson_plan += """
<br>
## 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
<br>
Illustrative Story: (Font Century Gothic 22pt)
[Generated Illustrative Story (200-500 words)] (Font Century Gothic 11pt)
<br>
Image Links and Captions: (Font Century Gothic 22pt)
<br>
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()