Manas281 commited on
Commit
d06768a
·
verified ·
1 Parent(s): 064a61a

Upload 2 files

Browse files
Files changed (2) hide show
  1. .env +2 -0
  2. app.py +724 -0
.env ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ YOUTUBE_API_KEY = AIzaSyAPoUwwPHqytoo258chZ4RA4N0dK55mbWQ
2
+ GEMINI_API_KEY = AIzaSyC63KH_nJwHUG0DAqAWnEF03ys0zlXri_M
app.py ADDED
@@ -0,0 +1,724 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import requests
3
+ import google.generativeai as genai
4
+ from bs4 import BeautifulSoup
5
+ from google.generativeai.types import HarmCategory, HarmBlockThreshold
6
+ import random
7
+ import json
8
+ from datetime import datetime, timedelta
9
+ import requests
10
+ import os
11
+ from dotenv import load_dotenv
12
+
13
+
14
+
15
+ load_dotenv()
16
+
17
+
18
+
19
+ YOUTUBE_API_KEY = os.environ.get('YOUTUBE_API_KEY')
20
+
21
+ GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY')
22
+ genai.configure(api_key=GEMINI_API_KEY)
23
+ model = genai.GenerativeModel('gemini-pro')
24
+ # Title for the application
25
+ st.title("👩‍🎓 AI Learning Assistant👨‍🎓")
26
+
27
+
28
+ st.sidebar.title("👩‍🔧 Select your Preferences🧑‍⚕️")
29
+
30
+ subjects_data = {
31
+ "CBSE": {
32
+ "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
33
+ "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
34
+ },
35
+ "ICSE": {
36
+ "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
37
+ "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
38
+ },
39
+
40
+ "Maharashtra": {
41
+ "11": ["Mathematics", "Physics", "Chemistry", "Biology"],
42
+ "12": ["Mathematics", "Physics", "Chemistry", "Biology"],
43
+ }
44
+
45
+ }
46
+
47
+ # Content data for each subject
48
+ content_data = {
49
+ "CBSE": {
50
+ "11": {
51
+ "Mathematics": [
52
+ "1. Sets",
53
+ "2. Relations and Functions",
54
+ "3. Trigonometric Functions",
55
+ "4. Principle of Mathematical Induction",
56
+ "5. Complex Numbers and Quadratic Equations",
57
+ "6. Linear Inequalities",
58
+ "7. Permutations and Combinations",
59
+ "8. Binomial Theorem",
60
+ "9. Sequences and Series",
61
+ "10. Straight Lines",
62
+ "11. Conic Sections",
63
+ "12. Introduction to Three-dimensional Geometry",
64
+ "13. Limits and Derivatives",
65
+ "14. Mathematical Reasoning",
66
+ "15. Statistics",
67
+ "16. Probability"
68
+ ],
69
+ "Physics": [
70
+ "1. Physical World",
71
+ "2. Units and Measurements",
72
+ "3. Motion in a Straight Line",
73
+ "4. Motion in a Plane",
74
+ "5. Laws of Motion",
75
+ "6. Work, Energy and Power",
76
+ "7. System of Particles and Rotational Motion",
77
+ "8. Gravitation",
78
+ "9. Mechanical Properties of Solids",
79
+ "10. Mechanical Properties of Fluids",
80
+ "11. Thermal Properties of Matter",
81
+ "12. Thermodynamics",
82
+ "13. Kinetic Theory",
83
+ "14. Oscillations",
84
+ "15. Waves"
85
+ ],
86
+ "Chemistry": [
87
+ "1. Some Basic Concepts of Chemistry",
88
+ "2. Structure of Atom",
89
+ "3. Classification of Elements and Periodicity in Properties",
90
+ "4. Chemical Bonding and Molecular Structure",
91
+ "5. States of Matter: Gases and Liquids",
92
+ "6. Thermodynamics",
93
+ "7. Equilibrium",
94
+ "8. Redox Reactions",
95
+ "9. Hydrogen",
96
+ "10. The s-Block Element",
97
+ "11. The p-Block Element",
98
+ "12. Organic Chemistry - Some Basic Principles and Techniques",
99
+ "13. Hydrocarbons",
100
+ "14. Environmental Chemistry"
101
+ ],
102
+ "Biology": [
103
+ "1. The Living World",
104
+ "2. Biological Classification",
105
+ "3. Plant Kingdom",
106
+ "4. Animal Kingdom",
107
+ "5. Morphology of Flowering Plants",
108
+ "6. Anatomy of Flowering Plants",
109
+ "7. Structural Organisation in Animals",
110
+ "8. Cell: The Unit of Life",
111
+ "9. Biomolecules",
112
+ "10. Cell Cycle and Cell Division",
113
+ "11. Transport in Plants",
114
+ "12. Mineral Nutrition",
115
+ "13. Photosynthesis in Higher Plants",
116
+ "14. Respiration in Plants",
117
+ "15. Plant - Growth and Development",
118
+ "16. Digestion and Absorption",
119
+ "17. Breathing and Exchange of Gases",
120
+ "18. Body Fluids and Circulation",
121
+ "19. Excretory Products and their Elimination",
122
+ "20. Locomotion and Movement",
123
+ "21. Neural Control and Coordination",
124
+ "22. Chemical Coordination and Integration"
125
+ ]
126
+ },
127
+ "12": {
128
+ "Mathematics": [
129
+ "1. Relations and Functions",
130
+ "2. Inverse Trigonometric Functions",
131
+ "3. Matrices",
132
+ "4. Determinants",
133
+ "5. Continuity and Differentiability",
134
+ "6. Applications of Derivatives",
135
+ "7. Integrals",
136
+ "8. Applications of Integrals",
137
+ "9. Differential Equations",
138
+ "10. Vector Algebra",
139
+ "11. Three-dimensional Geometry",
140
+ "12. Linear Programming",
141
+ "13. Probability"
142
+ ],
143
+ "Physics": [
144
+ "1. Electric Charges and Fields",
145
+ "2. Electrostatic Potential and Capacitance",
146
+ "3. Current Electricity",
147
+ "4. Moving Charges and Magnetism",
148
+ "5. Magnetism and Matter",
149
+ "6. Electromagnetic Induction",
150
+ "7. Alternating Currents",
151
+ "8. Electromagnetic Waves",
152
+ "9. Optics",
153
+ "10. Wave Optics",
154
+ "11. Dual Nature of Radiation and Matter",
155
+ "12. Atoms",
156
+ "13. Nuclei",
157
+ "14. Semiconductor Electronics",
158
+ "15. Communication Systems"
159
+ ],
160
+ "Chemistry": [
161
+ "1. The Solid State",
162
+ "2. Solutions",
163
+ "3. Electrochemistry",
164
+ "4. Chemical Kinetics",
165
+ "5. Surface Chemistry",
166
+ "6. General Principles and Processes of Isolation of Elements",
167
+ "7. p-Block Elements",
168
+ "8. d and f Block Elements",
169
+ "9. Coordination Compounds",
170
+ "10. Haloalkanes and Haloarenes",
171
+ "11. Alcohols, Phenols and Ethers",
172
+ "12. Aldehydes, Ketones and Carboxylic Acids",
173
+ "13. Organic Compounds Containing Nitrogen",
174
+ "14. Biomolecules",
175
+ "15. Polymers",
176
+ "16. Chemistry in Everyday Life"
177
+ ],
178
+ "Biology": [
179
+ "1. Reproduction in Organisms",
180
+ "2. Sexual Reproduction in Flowering Plants",
181
+ "3. Human Reproduction",
182
+ "4. Reproductive Health",
183
+ "5. Principles of Inheritance and Variation",
184
+ "6. Molecular Basis of Inheritance",
185
+ "7. Evolution",
186
+ "8. Human Health and Disease",
187
+ "9. Strategies for Enhancement in Food Production",
188
+ "10. Microbes in Human Welfare",
189
+ "11. Biotechnology - Principles and Processes",
190
+ "12. Biotechnology and its Applications",
191
+ "13. Organisms and Populations",
192
+ "14. Ecosystem",
193
+ "15. Biodiversity and Conservation",
194
+ "16. Environmental Issues"
195
+ ]
196
+ }
197
+ },
198
+ "ICSE": {
199
+ "11": {
200
+ "Mathematics": [
201
+ "1.Sets and Functions",
202
+ "2.Complex Numbers",
203
+ "3.Quadratic Equations",
204
+ "4.Permutations and Combinations",
205
+ "5.Binomial Theorem",
206
+ "6.Sequences and Series",
207
+ "7.Straight Lines",
208
+ "8.Conic Sections",
209
+ "9.Introduction to Three-Dimensional Geometry",
210
+ "10.Limits and Derivatives",
211
+ "11.Mathematical Reasoning",
212
+ "12.Statistics",
213
+ "13.Probability"
214
+ ],
215
+ "Physics": [
216
+ "1.Measurement",
217
+ "2.Kinematics",
218
+ "3.Dynamics",
219
+ "4.Work, Energy, and Power",
220
+ "5.Motion of System of Particles and Rigid Body",
221
+ "6.Gravitation",
222
+ "7.Properties of Matter",
223
+ "8.Heat",
224
+ "9.Wave Motion",
225
+ "10.Sound",
226
+ "11.Light",
227
+ "12.Electricity",
228
+ "13.Magnetism",
229
+ "14.Modern Physics",
230
+ ],
231
+ "Chemistry": [
232
+ "1. Basic Concepts of Chemistry",
233
+ "2. Structure of Atom",
234
+ "3. Periodic Table and Periodicity",
235
+ "4. Chemical Bonding and Molecular Structure",
236
+ "5. States of Matter",
237
+ "6. Thermodynamics",
238
+ "7. Equilibrium",
239
+ "8. Redox Reactions",
240
+ "9. Hydrogen",
241
+ "10. s-Block and p-Block Elements",
242
+ "11. Organic Chemistry - Basic Principles",
243
+ "12. Hydrocarbons",
244
+ "13. Environmental Chemistry"
245
+ ],
246
+ "Biology": [
247
+ "1.Cell: Structure and Function",
248
+ "2.Biomolecules",
249
+ "3.Cell Division",
250
+ "4.Plant Kingdom",
251
+ "5.Animal Kingdom",
252
+ "6.Structural Organisation in Animals and Plants",
253
+ "7.Human Physiology",
254
+ "8.Ecology and Environment"
255
+ ]
256
+ },
257
+ "12": {
258
+ "Mathematics": [
259
+ "1.Relations and Functions",
260
+ "2.Algebra"
261
+ "3.Calculus"
262
+ "4.Vectors"
263
+ "5.Three-Dimensional Geometry"
264
+ "6.Statistics"
265
+ "7.Probability"
266
+ "8.Linear Programming"
267
+ "9.Mathematical Reasoning"
268
+ ],
269
+ "Physics": [
270
+ "1. Electrostatics",
271
+ "2. Current Electricity",
272
+ "3. Magnetism",
273
+ "4. Electromagnetic Induction",
274
+ "5. Alternating Currents",
275
+ "6. Electromagnetic Waves",
276
+ "7. Optics",
277
+ "8. Dual Nature of Radiation",
278
+ "9. Atoms and Nuclei",
279
+ "10. Electronic Devices",
280
+
281
+ ],
282
+ "Chemistry": [
283
+ "1. Solutions",
284
+ "2. Electrochemistry",
285
+ "3. Chemical Kinetics",
286
+ "4. Surface Chemistry",
287
+ "5. General Principles of Isolation of Elements",
288
+ "6. p-Block Elements",
289
+ "7. d-Block and f-Block Elements",
290
+ "8. Coordination Compounds",
291
+ "9. Haloalkanes and Haloarenes",
292
+ "10. Alcohols, Phenols, and Ethers",
293
+ "11. Carbonyl Compounds",
294
+ "12.Carboxylic Acids",
295
+ "13. Organic Compounds Containing Nitrogen",
296
+ "14. Biomolecules",
297
+ "15. Polymers",
298
+ "16. Chemistry in Everyday Life"
299
+ ],
300
+ "Biology": [
301
+ "1. Reproduction",
302
+ "2. Genetics and Evolution",
303
+ "3. Biotechnology and its Applications",
304
+ "4. Ecology and Environment",
305
+ ]
306
+ }
307
+ },
308
+ "Maharashtra": {
309
+ "11": {
310
+ "Mathematics": [
311
+ "1.Angle and Its Measurement",
312
+ "2.Trigonometry - 1",
313
+ "3.Trigonometry - 2",
314
+ "4.Determinants and Matrices",
315
+ "5.Straight Line",
316
+ "6.Circle",
317
+ "7.Conic Sections",
318
+ "8.Measures of Dispersion",
319
+ "9.Probability",
320
+ "10.Complex Numbers",
321
+ "11.Sequences and Series",
322
+ "12.Permutations and Combination",
323
+ "13.Methods of Induction and Binomial Theorem",
324
+ "14.Sets and Relations",
325
+ "15.Functions",
326
+ "16.Limits",
327
+ "17.Continuity",
328
+ "18.Differentiation"
329
+ ],
330
+ "Physics": [
331
+ "1.Units and Measurements",
332
+ "2.Mathematical Methods",
333
+ "3.Motion in a Plane",
334
+ "4.Laws of Motion",
335
+ "5.Gravitation",
336
+ "6.Mechanical Properties of Solids",
337
+ "7.Thermal Properties of Matter",
338
+ "8.Sound",
339
+ "9.Optics",
340
+ "10.Electrostatics",
341
+ "11.Electric Current Through Conductors",
342
+ "12.Magnetism",
343
+ "13.Electromagnetic Waves and Communication System",
344
+ "14.Semiconductors"
345
+ ],
346
+ "Chemistry": [
347
+ "1.Some Basic Concepts of Chemistry",
348
+ "2.Structure of Atom",
349
+ "3.Classification of Elements and Periodicity in Properties",
350
+ "4.Chemical Bonding and Molecular Structure",
351
+ "5.States of Matter: Gases and Liquids",
352
+ "6.Thermodynamics",
353
+ "7.Equilibrium",
354
+ "8.Redox Reactions",
355
+ "9.Hydrogen",
356
+ "10.s-Block Element (Alkali and Alkaline earth metals)",
357
+ "11.Some p-Block Elements",
358
+ "12.Organic Chemistry - Some Basic Principles and Techniques",
359
+ "13.Hydrocarbons",
360
+ "14.Environmental Chemistry"
361
+ ],
362
+ "Biology": [
363
+ "1.Living World",
364
+ "2.Systematics of Living Organisms",
365
+ "3.Kingdom Plantae",
366
+ "4.Kingdom Animalia",
367
+ "5.Cell Structure and Organization",
368
+ "6.Biomolecules",
369
+ "7.Cell Division",
370
+ "8.Plant Tissues and Anatomy",
371
+ "9.Morphology of Flowering Plants",
372
+ "10.Animal Tissue",
373
+ "11.Study of Animal Type: Cockroach",
374
+ "12.Photosynthesis",
375
+ "13.Respiration and Energy Transfer",
376
+ "14.Human Nutrition",
377
+ "15.Excretion and Osmoregulation",
378
+ "16.Skeleton and Movement"
379
+ ]
380
+ },
381
+ "12": {
382
+ "Mathematics": [
383
+ "1.Relations and Functions",
384
+ "2.Inverse Trigonometric Functions",
385
+ "3.Matrices",
386
+ "4.Determinants",
387
+ "5.Continuity and Differentiability",
388
+ "6.Applications of Derivatives",
389
+ "7.Integrals",
390
+ "8.Applications of Integrals",
391
+ "9.Differential Equations",
392
+ "10.Vector Algebra",
393
+ "11.Three-dimensional Geometry",
394
+ "12.Linear Programming",
395
+ "13.Probability"
396
+ ],
397
+ "Physics": [
398
+ "1.Electric Charges and Fields",
399
+ "2.Electrostatic Potential and Capacitance",
400
+ "3.Current Electricity",
401
+ "4.Moving Charges and Magnetism",
402
+ "5.Magnetism and Matter",
403
+ "6.Electromagnetic Induction",
404
+ "7.Alternating Currents",
405
+ "8.Electromagnetic Waves",
406
+ "9.Ray Optics and Optical Instruments",
407
+ "10.Wave Optics",
408
+ "11.Dual Nature of Radiation and Matter",
409
+ "12.Atoms and Nuclei",
410
+ "13.Electronic Devices"],
411
+
412
+ "Chemistry": [
413
+ "1.Solid State",
414
+ "2.Solutions",
415
+ "3.Electrochemistry",
416
+ "4.Chemical Kinetics",
417
+ "5.Surface Chemistry",
418
+ "6.General Principles and Processes of Isolation of Elements",
419
+ "7.p-Block Elements",
420
+ "8.d and f Block Elements",
421
+ "9.Coordination Compounds",
422
+ "10.Haloalkanes and Haloarenes",
423
+ "11.Alcohols, Phenols, and Ethers",
424
+ "12.Carbonyl Compounds",
425
+ "13.Carboxylic Acids and Their Derivatives",
426
+ "14.Biomolecules",
427
+ "15.Polymers",
428
+ "16.Chemistry in Everyday Life",
429
+ ],
430
+ "Biology": [
431
+ "1.Reproduction in Organisms",
432
+ "2.Sexual Reproduction in Flowering Plants",
433
+ "3.Human Reproduction",
434
+ "4.Principles of Inheritance and Variation",
435
+ "5.Molecular Basis of Inheritance",
436
+ "6.Evolution",
437
+ "7.Biotechnology Principles",
438
+ "8.Biotechnology and its Applications in Medicine",
439
+ "9.Ecosystem",
440
+ "10.Biodiversity and Conservation",
441
+ "11.Environmental Issues",
442
+ ]
443
+ }
444
+ }
445
+ }
446
+
447
+
448
+
449
+ board = st.sidebar.selectbox("Select Board", ["Maharashtra", "ICSE", "CBSE"])
450
+
451
+ # If "State" board is selected, show an additional dropdown for selecting the state
452
+
453
+
454
+ standard = st.sidebar.selectbox("Select Standard", ["11", "12"])
455
+
456
+ subject = st.sidebar.selectbox("Select Subject", subjects_data[board][standard])
457
+
458
+ chapter=st.sidebar.selectbox(("Select Chapter"),content_data[board][standard][subject])
459
+
460
+
461
+
462
+
463
+ # Form for creating short notes
464
+ with st.form("Short Notes"):
465
+ s_notes = st.form_submit_button("📋 Create Short Notes 📋")
466
+
467
+ if s_notes:
468
+
469
+ def generate_short_notes(board, standard, subject, chapter):
470
+ prompt = (f"Create concise ,brief ,including a section which student tend to neglect and informative short notes for {subject}, "
471
+ f"Chapter: {chapter} as per {board} {standard} curriculum.")
472
+
473
+ try:
474
+ response = model.generate_content(
475
+ prompt
476
+ )
477
+ return response.text
478
+
479
+ except Exception as e:
480
+ return "Error generating short notes: " + str(e)
481
+
482
+
483
+ # Generate and display the notes
484
+ notes = generate_short_notes(board, standard, subject, chapter)
485
+ st.write("### Short Notes")
486
+ st.write(notes)
487
+
488
+ with st.form("Formulas"):
489
+ formula = st.form_submit_button("⚛️ Get Formulas ⚛️")
490
+
491
+ if formula:
492
+
493
+ def formulas(board, standard, subject, chapter):
494
+ prompt = (f"Create a formula list for {subject}, "
495
+ f"Chapter: {chapter} as per {board} {standard} curriculum.")
496
+
497
+ try:
498
+ response = model.generate_content(
499
+ prompt
500
+ )
501
+ return response.text
502
+
503
+ except Exception as e:
504
+ return "Error generating short notes: " + str(e)
505
+
506
+
507
+ # Generate and display the notes
508
+ notes = formulas(board, standard, subject, chapter)
509
+ st.write("### Formula list")
510
+ st.write(notes)
511
+
512
+ with st.form("questions"):
513
+ questions= st.form_submit_button("📑📊Get questions📊📑")
514
+
515
+ if questions:
516
+
517
+ def get_questions(board, standard, subject, chapter):
518
+ prompt = (f"Create atleast 10 most important questions (thoerotical as well as numericals) which are frequently asked for {subject}, "
519
+ f"Chapter: {chapter} as per {board} {standard} curriculum.")
520
+
521
+ try:
522
+ response = model.generate_content(
523
+ prompt
524
+ )
525
+ return response.text
526
+
527
+ except Exception as e:
528
+ return "Error generating short notes: " + str(e)
529
+
530
+
531
+ # Generate and display the notes
532
+ notes = get_questions(board, standard, subject, chapter)
533
+ st.write("### questions")
534
+ st.write(notes)
535
+
536
+
537
+ with st.form("PYQS"):
538
+ pyqs= st.form_submit_button("📇 Get PYQS 📇")
539
+
540
+ if pyqs:
541
+
542
+ def get_pyqs(board, standard, subject, chapter):
543
+ prompt = (f"Give the most trending, hot and important mcq pyqs from jee mains,neet and advance atleast 15 for {subject}, "
544
+ f"Chapter: {chapter} as per {board} {standard} curriculum.")
545
+
546
+ try:
547
+ response = model.generate_content(
548
+ prompt
549
+ )
550
+ return response.text
551
+
552
+ except Exception as e:
553
+ return "Error generating short notes: " + str(e)
554
+
555
+
556
+ # Generate and display the notes
557
+ notes = get_pyqs(board, standard, subject, chapter)
558
+ st.write("### pyqs")
559
+ st.write(notes)
560
+
561
+
562
+
563
+
564
+
565
+
566
+
567
+
568
+
569
+ # Streamlit form for user input
570
+ with st.form("YouTube Videos"):
571
+
572
+ videos = st.form_submit_button("▶️🎦Get Youtube videos links 🎦▶️")
573
+
574
+ if videos:
575
+
576
+ def get_youtube_videos(subject, chapter, board):
577
+ 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}"
578
+
579
+ try:
580
+ response = requests.get(search_url)
581
+ data = response.json()
582
+ video_list = []
583
+
584
+ for item in data.get('items', []):
585
+ video_title = item['snippet']['title']
586
+ video_id = item['id'].get('videoId')
587
+ if video_id: # Check if videoId exists
588
+ video_url = f"https://www.youtube.com/watch?v={video_id}"
589
+ video_list.append((video_title, video_url))
590
+
591
+ return video_list
592
+
593
+ except Exception as e:
594
+ return [f"Error fetching YouTube videos: {str(e)}"]
595
+
596
+
597
+ # Generate and display the video links
598
+ links = get_youtube_videos(subject, chapter, board)
599
+ st.write("*YouTube Videos:*")
600
+
601
+ if links:
602
+ for title, url in links:
603
+ st.write(f"- [{title}]({url})")
604
+ else:
605
+ st.write("No videos found.")
606
+
607
+
608
+
609
+ with st.form("Books Recommendations"):
610
+ books= st.form_submit_button("📚 Get Books Recommendations 📚")
611
+
612
+ if books:
613
+
614
+ def get_books(board, standard, subject, chapter):
615
+ prompt = (f"Give the book recommendation for {subject}, "
616
+ f"Chapter: {chapter} as per {board} {standard} curriculum.")
617
+
618
+ try:
619
+ response = model.generate_content(
620
+ prompt
621
+ )
622
+ return response.text
623
+
624
+ except Exception as e:
625
+ return "Error generating short notes: " + str(e)
626
+
627
+
628
+ # Generate and display the notes
629
+ book = get_books(board, standard, subject, chapter)
630
+ st.write("### Books")
631
+ st.write(book)
632
+
633
+
634
+ def ask_query(chat):
635
+ prompt = f"Solve the query as if you are his teacher: {chat}"
636
+
637
+ try:
638
+ # Generate response using the model
639
+ response = model.generate_content(prompt)
640
+ return response.text
641
+
642
+ except Exception as e:
643
+ return "Error generating response: " + str(e)
644
+
645
+
646
+ chat = st.text_input("❓❓Ask any query❓❓")
647
+
648
+ if chat:
649
+ solution = ask_query(chat)
650
+ st.write(solution)
651
+
652
+
653
+ st.markdown('''
654
+ <style>
655
+ /* General background with gradient */
656
+ .reportview-container {
657
+ background: linear-gradient(135deg, #2196f3, #e3f2fd);
658
+ padding: 20px;
659
+ font-family: 'Roboto', sans-serif;
660
+ }
661
+
662
+ /* Header styling with shadow and gradient text */
663
+ h1, .title {
664
+ color: #1a237e;
665
+ font-size: 3.5em;
666
+ font-weight: 800;
667
+ background: linear-gradient(to right, #42a5f5, #1e88e5);
668
+ -webkit-background-clip: text;
669
+ color: black;
670
+ text-align: center;
671
+ margin-bottom: 20px;
672
+ text-shadow: 1px 1px 2px #e3f2fd;
673
+ }
674
+
675
+ /* Sidebar and panel styles */
676
+ .sidebar .sidebar-content {
677
+ background-color: #e3f2fd;
678
+ padding: 25px;
679
+ border-radius: 10px;
680
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
681
+ font-size: 2.1em;
682
+ color: #0d47a1;
683
+ }
684
+
685
+ /* Enhanced button styling */
686
+ .stButton>button {
687
+ background: linear-gradient(135deg, #42a5f5, #1e88e5);
688
+ color: white;
689
+ font-size: 2.1em;
690
+ font-weight: 600;
691
+ padding: 12px 25px;
692
+ border: none;
693
+ border-radius: 8px;
694
+ box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.1);
695
+ transition: all 0.3s ease;
696
+ }
697
+ .stButton>button:hover {
698
+ background: linear-gradient(135deg, #1e88e5, #42a5f5);
699
+ transform: translateY(-2px);
700
+ box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.2);
701
+ }
702
+
703
+ /* Container styling with rounded borders and shadow */
704
+ .container {
705
+ background: white;
706
+ border-radius: 12px;
707
+ padding: 20px;
708
+ box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
709
+ margin: 20px 0;
710
+ font-size: 2.1em;
711
+ }
712
+
713
+ /* Animations */
714
+ .fade-in {
715
+ animation: fadeIn 0.8s ease-in-out;
716
+ }
717
+
718
+ @keyframes fadeIn {
719
+ from { opacity: 0; transform: translateY(10px); }
720
+ to { opacity: 1; transform: translateY(0); }
721
+ }
722
+
723
+ </style>
724
+ ''', unsafe_allow_html=True)