File size: 24,197 Bytes
d06768a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
import streamlit as st
import requests
import google.generativeai as genai
from bs4 import BeautifulSoup
from google.generativeai.types import HarmCategory, HarmBlockThreshold
import random
import json
from datetime import datetime, timedelta
import requests
import os
from dotenv import load_dotenv



load_dotenv()



YOUTUBE_API_KEY = os.environ.get('YOUTUBE_API_KEY')

GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY')
genai.configure(api_key=GEMINI_API_KEY)
model = genai.GenerativeModel('gemini-pro')
# Title for the application
st.title("👩‍🎓 AI Learning Assistant👨‍🎓")


st.sidebar.title("👩‍🔧 Select your Preferences🧑‍⚕️")

subjects_data = {
    "CBSE": {
        "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
        "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
    },
    "ICSE": {
        "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
        "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
    },

     "Maharashtra": {
            "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
            "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
        }

}

# Content data for each subject
content_data = {
    "CBSE": {
        "11": {
            "Mathematics": [
                "1. Sets",
                "2. Relations and Functions",
                "3. Trigonometric Functions",
                "4. Principle of Mathematical Induction",
                "5. Complex Numbers and Quadratic Equations",
                "6. Linear Inequalities",
                "7. Permutations and Combinations",
                "8. Binomial Theorem",
                "9. Sequences and Series",
                "10. Straight Lines",
                "11. Conic Sections",
                "12. Introduction to Three-dimensional Geometry",
                "13. Limits and Derivatives",
                "14. Mathematical Reasoning",
                "15. Statistics",
                "16. Probability"
            ],
            "Physics": [
                "1. Physical World",
                "2. Units and Measurements",
                "3. Motion in a Straight Line",
                "4. Motion in a Plane",
                "5. Laws of Motion",
                "6. Work, Energy and Power",
                "7. System of Particles and Rotational Motion",
                "8. Gravitation",
                "9. Mechanical Properties of Solids",
                "10. Mechanical Properties of Fluids",
                "11. Thermal Properties of Matter",
                "12. Thermodynamics",
                "13. Kinetic Theory",
                "14. Oscillations",
                "15. Waves"
            ],
            "Chemistry": [
                "1. Some Basic Concepts of Chemistry",
                "2. Structure of Atom",
                "3. Classification of Elements and Periodicity in Properties",
                "4. Chemical Bonding and Molecular Structure",
                "5. States of Matter: Gases and Liquids",
                "6. Thermodynamics",
                "7. Equilibrium",
                "8. Redox Reactions",
                "9. Hydrogen",
                "10. The s-Block Element",
                "11. The p-Block Element",
                "12. Organic Chemistry - Some Basic Principles and Techniques",
                "13. Hydrocarbons",
                "14. Environmental Chemistry"
            ],
            "Biology": [
                "1. The Living World",
                "2. Biological Classification",
                "3. Plant Kingdom",
                "4. Animal Kingdom",
                "5. Morphology of Flowering Plants",
                "6. Anatomy of Flowering Plants",
                "7. Structural Organisation in Animals",
                "8. Cell: The Unit of Life",
                "9. Biomolecules",
                "10. Cell Cycle and Cell Division",
                "11. Transport in Plants",
                "12. Mineral Nutrition",
                "13. Photosynthesis in Higher Plants",
                "14. Respiration in Plants",
                "15. Plant - Growth and Development",
                "16. Digestion and Absorption",
                "17. Breathing and Exchange of Gases",
                "18. Body Fluids and Circulation",
                "19. Excretory Products and their Elimination",
                "20. Locomotion and Movement",
                "21. Neural Control and Coordination",
                "22. Chemical Coordination and Integration"
            ]
        },
        "12": {
            "Mathematics": [
                "1. Relations and Functions",
                "2. Inverse Trigonometric Functions",
                "3. Matrices",
                "4. Determinants",
                "5. Continuity and Differentiability",
                "6. Applications of Derivatives",
                "7. Integrals",
                "8. Applications of Integrals",
                "9. Differential Equations",
                "10. Vector Algebra",
                "11. Three-dimensional Geometry",
                "12. Linear Programming",
                "13. Probability"
            ],
            "Physics": [
                "1. Electric Charges and Fields",
                "2. Electrostatic Potential and Capacitance",
                "3. Current Electricity",
                "4. Moving Charges and Magnetism",
                "5. Magnetism and Matter",
                "6. Electromagnetic Induction",
                "7. Alternating Currents",
                "8. Electromagnetic Waves",
                "9. Optics",
                "10. Wave Optics",
                "11. Dual Nature of Radiation and Matter",
                "12. Atoms",
                "13. Nuclei",
                "14. Semiconductor Electronics",
                "15. Communication Systems"
            ],
            "Chemistry": [
                "1. The Solid State",
                "2. Solutions",
                "3. Electrochemistry",
                "4. Chemical Kinetics",
                "5. Surface Chemistry",
                "6. General Principles and Processes of Isolation of Elements",
                "7. p-Block Elements",
                "8. d and f Block Elements",
                "9. Coordination Compounds",
                "10. Haloalkanes and Haloarenes",
                "11. Alcohols, Phenols and Ethers",
                "12. Aldehydes, Ketones and Carboxylic Acids",
                "13. Organic Compounds Containing Nitrogen",
                "14. Biomolecules",
                "15. Polymers",
                "16. Chemistry in Everyday Life"
            ],
            "Biology": [
                "1. Reproduction in Organisms",
                "2. Sexual Reproduction in Flowering Plants",
                "3. Human Reproduction",
                "4. Reproductive Health",
                "5. Principles of Inheritance and Variation",
                "6. Molecular Basis of Inheritance",
                "7. Evolution",
                "8. Human Health and Disease",
                "9. Strategies for Enhancement in Food Production",
                "10. Microbes in Human Welfare",
                "11. Biotechnology - Principles and Processes",
                "12. Biotechnology and its Applications",
                "13. Organisms and Populations",
                "14. Ecosystem",
                "15. Biodiversity and Conservation",
                "16. Environmental Issues"
            ]
        }
    },
    "ICSE": {
        "11": {
            "Mathematics": [
                "1.Sets and Functions",
"2.Complex Numbers",
"3.Quadratic Equations",
"4.Permutations and Combinations",
"5.Binomial Theorem",
"6.Sequences and Series",
"7.Straight Lines",
"8.Conic Sections",
"9.Introduction to Three-Dimensional Geometry",
"10.Limits and Derivatives",
"11.Mathematical Reasoning",
"12.Statistics",
"13.Probability"
            ],
            "Physics": [
                "1.Measurement",
"2.Kinematics",
"3.Dynamics",
"4.Work, Energy, and Power",
"5.Motion of System of Particles and Rigid Body",
"6.Gravitation",
"7.Properties of Matter",
"8.Heat",
"9.Wave Motion",
"10.Sound",
"11.Light",
"12.Electricity",
"13.Magnetism",
"14.Modern Physics",
            ],
            "Chemistry": [
                "1. Basic Concepts of Chemistry",
                "2. Structure of Atom",
                "3. Periodic Table and Periodicity",
                "4. Chemical Bonding and Molecular Structure",
                "5. States of Matter",
                "6. Thermodynamics",
                "7. Equilibrium",
                "8. Redox Reactions",
                "9. Hydrogen",
                "10. s-Block and p-Block Elements",
                "11. Organic Chemistry - Basic Principles",
                "12. Hydrocarbons",
                "13. Environmental Chemistry"
            ],
            "Biology": [
                "1.Cell: Structure and Function",
"2.Biomolecules",
"3.Cell Division",
"4.Plant Kingdom",
"5.Animal Kingdom",
"6.Structural Organisation in Animals and Plants",
"7.Human Physiology",
"8.Ecology and Environment"
            ]
        },
        "12": {
            "Mathematics": [
                "1.Relations and Functions",
"2.Algebra"
"3.Calculus"
"4.Vectors"
"5.Three-Dimensional Geometry"
"6.Statistics"
"7.Probability"
"8.Linear Programming"
"9.Mathematical Reasoning"
            ],
            "Physics": [
                "1. Electrostatics",
                "2. Current Electricity",
                "3. Magnetism",
                "4. Electromagnetic Induction",
                "5. Alternating Currents",
                "6. Electromagnetic Waves",
                "7. Optics",
                "8. Dual Nature of Radiation",
                "9. Atoms and Nuclei",
                "10. Electronic Devices",

            ],
            "Chemistry": [
                "1. Solutions",
                "2. Electrochemistry",
                "3. Chemical Kinetics",
                "4. Surface Chemistry",
                "5. General Principles of Isolation of Elements",
                "6. p-Block Elements",
                "7. d-Block and f-Block Elements",
                "8. Coordination Compounds",
                "9. Haloalkanes and Haloarenes",
                "10. Alcohols, Phenols, and Ethers",
                "11. Carbonyl Compounds",
                "12.Carboxylic Acids",
                "13. Organic Compounds Containing Nitrogen",
                "14. Biomolecules",
                "15. Polymers",
                "16. Chemistry in Everyday Life"
            ],
            "Biology": [
                "1. Reproduction",
                "2. Genetics and Evolution",
                "3. Biotechnology and its Applications",
                "4. Ecology and Environment",
            ]
        }
    },
    "Maharashtra": {
        "11": {
            "Mathematics": [
                "1.Angle and Its Measurement",
    "2.Trigonometry - 1",
    "3.Trigonometry - 2",
    "4.Determinants and Matrices",
    "5.Straight Line",
    "6.Circle",
    "7.Conic Sections",
    "8.Measures of Dispersion",
    "9.Probability",
    "10.Complex Numbers",
    "11.Sequences and Series",
    "12.Permutations and Combination",
    "13.Methods of Induction and Binomial Theorem",
    "14.Sets and Relations",
    "15.Functions",
    "16.Limits",
    "17.Continuity",
    "18.Differentiation"
            ],
            "Physics": [
                "1.Units and Measurements",
                "2.Mathematical Methods",
                "3.Motion in a Plane",
                "4.Laws of Motion",
                "5.Gravitation",
                "6.Mechanical Properties of Solids",
                "7.Thermal Properties of Matter",
                "8.Sound",
                "9.Optics",
                "10.Electrostatics",
                "11.Electric Current Through Conductors",
                "12.Magnetism",
                "13.Electromagnetic Waves and Communication System",
                "14.Semiconductors"
            ],
            "Chemistry": [
                "1.Some Basic Concepts of Chemistry",
                "2.Structure of Atom",
                "3.Classification of Elements and Periodicity in Properties",
                "4.Chemical Bonding and Molecular Structure",
                "5.States of Matter: Gases and Liquids",
                "6.Thermodynamics",
                "7.Equilibrium",
                "8.Redox Reactions",
                "9.Hydrogen",
                "10.s-Block Element (Alkali and Alkaline earth metals)",
                "11.Some p-Block Elements",
                "12.Organic Chemistry - Some Basic Principles and Techniques",
                "13.Hydrocarbons",
                "14.Environmental Chemistry"
            ],
            "Biology": [
                 "1.Living World",
                 "2.Systematics of Living Organisms",
    "3.Kingdom Plantae",
    "4.Kingdom Animalia",
    "5.Cell Structure and Organization",
    "6.Biomolecules",
    "7.Cell Division",
    "8.Plant Tissues and Anatomy",
    "9.Morphology of Flowering Plants",
    "10.Animal Tissue",
    "11.Study of Animal Type: Cockroach",
    "12.Photosynthesis",
    "13.Respiration and Energy Transfer",
    "14.Human Nutrition",
    "15.Excretion and Osmoregulation",
    "16.Skeleton and Movement"
            ]
        },
        "12": {
            "Mathematics": [
                "1.Relations and Functions",
                "2.Inverse Trigonometric Functions",
                "3.Matrices",
                "4.Determinants",
                "5.Continuity and Differentiability",
                "6.Applications of Derivatives",
                "7.Integrals",
                "8.Applications of Integrals",
                "9.Differential Equations",
                "10.Vector Algebra",
                "11.Three-dimensional Geometry",
                "12.Linear Programming",
                "13.Probability"
            ],
            "Physics": [
                "1.Electric Charges and Fields",
"2.Electrostatic Potential and Capacitance",
"3.Current Electricity",
"4.Moving Charges and Magnetism",
"5.Magnetism and Matter",
"6.Electromagnetic Induction",
"7.Alternating Currents",
"8.Electromagnetic Waves",
"9.Ray Optics and Optical Instruments",
"10.Wave Optics",
"11.Dual Nature of Radiation and Matter",
"12.Atoms and Nuclei",
"13.Electronic Devices"],

            "Chemistry": [
                "1.Solid State",
"2.Solutions",
"3.Electrochemistry",
"4.Chemical Kinetics",
"5.Surface Chemistry",
"6.General Principles and Processes of Isolation of Elements",
"7.p-Block Elements",
"8.d and f Block Elements",
"9.Coordination Compounds",
"10.Haloalkanes and Haloarenes",
"11.Alcohols, Phenols, and Ethers",
"12.Carbonyl Compounds",
"13.Carboxylic Acids and Their Derivatives",
"14.Biomolecules",
"15.Polymers",
"16.Chemistry in Everyday Life",
            ],
            "Biology": [
                "1.Reproduction in Organisms",
"2.Sexual Reproduction in Flowering Plants",
"3.Human Reproduction",
"4.Principles of Inheritance and Variation",
"5.Molecular Basis of Inheritance",
"6.Evolution",
"7.Biotechnology Principles",
"8.Biotechnology and its Applications in Medicine",
"9.Ecosystem",
"10.Biodiversity and Conservation",
"11.Environmental Issues",
            ]
        }
    }
}



board = st.sidebar.selectbox("Select Board", ["Maharashtra", "ICSE", "CBSE"])

# If "State" board is selected, show an additional dropdown for selecting the state


standard = st.sidebar.selectbox("Select Standard", ["11", "12"])

subject = st.sidebar.selectbox("Select Subject", subjects_data[board][standard])

chapter=st.sidebar.selectbox(("Select Chapter"),content_data[board][standard][subject])




# Form for creating short notes
with st.form("Short Notes"):
    s_notes = st.form_submit_button("📋 Create Short Notes 📋")

    if s_notes:

        def generate_short_notes(board, standard, subject, chapter):
            prompt = (f"Create concise ,brief ,including a section which student tend to  neglect  and informative short notes for {subject}, "
                      f"Chapter: {chapter} as per {board} {standard} curriculum.")

            try:
                response = model.generate_content(
                    prompt
                )
                return response.text

            except Exception as e:
                return "Error generating short notes: " + str(e)


        # Generate and display the notes
        notes = generate_short_notes(board, standard, subject, chapter)
        st.write("### Short Notes")
        st.write(notes)

with st.form("Formulas"):
    formula = st.form_submit_button("⚛️ Get Formulas ⚛️")

    if formula:

        def formulas(board, standard, subject, chapter):
            prompt = (f"Create a formula list  for {subject}, "
                      f"Chapter: {chapter} as per {board} {standard} curriculum.")

            try:
                response = model.generate_content(
                    prompt
                )
                return response.text

            except Exception as e:
                return "Error generating short notes: " + str(e)


        # Generate and display the notes
        notes = formulas(board, standard, subject, chapter)
        st.write("### Formula list")
        st.write(notes)

with st.form("questions"):
    questions= st.form_submit_button("📑📊Get questions📊📑")

    if questions:

        def get_questions(board, standard, subject, chapter):
            prompt = (f"Create atleast 10 most important questions (thoerotical as well as numericals)  which are frequently asked for {subject}, "
                      f"Chapter: {chapter} as per {board} {standard} curriculum.")

            try:
                response = model.generate_content(
                    prompt
                )
                return response.text

            except Exception as e:
                return "Error generating short notes: " + str(e)


        # Generate and display the notes
        notes = get_questions(board, standard, subject, chapter)
        st.write("### questions")
        st.write(notes)


with st.form("PYQS"):
    pyqs= st.form_submit_button("📇 Get PYQS 📇")

    if pyqs:

        def get_pyqs(board, standard, subject, chapter):
            prompt = (f"Give the most trending, hot and important mcq pyqs from jee mains,neet and advance atleast 15 for {subject}, "
                      f"Chapter: {chapter} as per {board} {standard} curriculum.")

            try:
                response = model.generate_content(
                    prompt
                )
                return response.text

            except Exception as e:
                return "Error generating short notes: " + str(e)


        # Generate and display the notes
        notes = get_pyqs(board, standard, subject, chapter)
        st.write("### pyqs")
        st.write(notes)









# Streamlit form for user input
with st.form("YouTube Videos"):

    videos = st.form_submit_button("▶️🎦Get Youtube videos links 🎦▶️")

    if videos:

        def get_youtube_videos(subject, chapter, board):
            search_url = f"https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=5&q={subject}{chapter}{board}+tutorial&type=video&key={YOUTUBE_API_KEY}"

            try:
                response = requests.get(search_url)
                data = response.json()
                video_list = []

                for item in data.get('items', []):
                    video_title = item['snippet']['title']
                    video_id = item['id'].get('videoId')
                    if video_id:  # Check if videoId exists
                        video_url = f"https://www.youtube.com/watch?v={video_id}"
                        video_list.append((video_title, video_url))

                return video_list

            except Exception as e:
                return [f"Error fetching YouTube videos: {str(e)}"]


        # Generate and display the video links
        links = get_youtube_videos(subject, chapter, board)
        st.write("*YouTube Videos:*")

        if links:
            for title, url in links:
                st.write(f"- [{title}]({url})")
        else:
            st.write("No videos found.")



with st.form("Books Recommendations"):
    books= st.form_submit_button("📚 Get Books Recommendations 📚")

    if books:

        def get_books(board, standard, subject, chapter):
            prompt = (f"Give the book recommendation  for {subject}, "
                      f"Chapter: {chapter} as per {board} {standard} curriculum.")

            try:
                response = model.generate_content(
                    prompt
                )
                return response.text

            except Exception as e:
                return "Error generating short notes: " + str(e)


        # Generate and display the notes
        book = get_books(board, standard, subject, chapter)
        st.write("### Books")
        st.write(book)


def ask_query(chat):
    prompt = f"Solve the query as if you are his teacher: {chat}"

    try:
        # Generate response using the model
        response = model.generate_content(prompt)
        return response.text

    except Exception as e:
        return "Error generating response: " + str(e)


chat = st.text_input("❓❓Ask any query❓❓")

if chat:
    solution = ask_query(chat)
    st.write(solution)


st.markdown('''

<style>

    /* General background with gradient */

    .reportview-container {

        background: linear-gradient(135deg, #2196f3, #e3f2fd);

        padding: 20px;

        font-family: 'Roboto', sans-serif;

    }



    /* Header styling with shadow and gradient text */

    h1, .title {

        color: #1a237e;

        font-size: 3.5em;

        font-weight: 800;

        background: linear-gradient(to right, #42a5f5, #1e88e5);

        -webkit-background-clip: text;

        color: black;

        text-align: center;

        margin-bottom: 20px;

        text-shadow: 1px 1px 2px #e3f2fd;

    }



    /* Sidebar and panel styles */

    .sidebar .sidebar-content {

        background-color: #e3f2fd;

        padding: 25px;

        border-radius: 10px;

        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);

        font-size: 2.1em;

        color: #0d47a1;

    }



    /* Enhanced button styling */

    .stButton>button {

        background: linear-gradient(135deg, #42a5f5, #1e88e5);

        color: white;

        font-size: 2.1em;

        font-weight: 600;

        padding: 12px 25px;

        border: none;

        border-radius: 8px;

        box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.1);

        transition: all 0.3s ease;

    }

    .stButton>button:hover {

        background: linear-gradient(135deg, #1e88e5, #42a5f5);

        transform: translateY(-2px);

        box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.2);

    }



    /* Container styling with rounded borders and shadow */

    .container {

        background: white;

        border-radius: 12px;

        padding: 20px;

        box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);

        margin: 20px 0;

        font-size: 2.1em;

    }



    /* Animations */

    .fade-in {

        animation: fadeIn 0.8s ease-in-out;

    }



    @keyframes fadeIn {

        from { opacity: 0; transform: translateY(10px); }

        to { opacity: 1; transform: translateY(0); }

    }



</style>

''', unsafe_allow_html=True)