ai-instructor-tarun commited on
Commit
ca25587
·
verified ·
1 Parent(s): 46feb0a

Upload 4 files

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. README.md +82 -14
  3. app.py +454 -0
  4. requirements.txt +1 -0
  5. screenshot.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ screenshot.png filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,14 +1,82 @@
1
- ---
2
- title: Krish2
3
- emoji: 🚀
4
- colorFrom: gray
5
- colorTo: indigo
6
- sdk: gradio
7
- sdk_version: 6.14.0
8
- python_version: '3.13'
9
- app_file: app.py
10
- pinned: false
11
- license: mit
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ </> Markdown
2
+
3
+ \---
4
+
5
+ title: AI Study Assistant
6
+
7
+ emoji: 📚
8
+
9
+ colorFrom: blue
10
+
11
+ colorTo: indigo
12
+
13
+ sdk: gradio
14
+
15
+ app\_file: app.py
16
+
17
+ pinned: false
18
+
19
+ \---
20
+
21
+
22
+
23
+ \# AI Study Assistant
24
+
25
+
26
+
27
+ An AI-powered study planning assistant designed to help students create personalized study sessions and improve academic performance.
28
+
29
+
30
+
31
+ \## Features
32
+
33
+
34
+
35
+ \- Personalized study session generation
36
+
37
+ \- Study plans based on:
38
+
39
+ &#x20; - subject
40
+
41
+ &#x20; - learning style
42
+
43
+ &#x20; - difficulty level
44
+
45
+ &#x20; - stress level
46
+
47
+ &#x20; - available study time
48
+
49
+ \- Professional AI-powered interface
50
+
51
+ \- Beginner-friendly design
52
+
53
+ \- Responsive Gradio frontend
54
+
55
+
56
+
57
+ \## Technologies Used
58
+
59
+
60
+
61
+ \- Python
62
+
63
+ \- Gradio
64
+
65
+ \- HTML/CSS
66
+
67
+
68
+
69
+ \## Purpose
70
+
71
+
72
+
73
+ This project was designed to help students study more efficiently by generating structured and personalized study plans in seconds.
74
+
75
+
76
+
77
+ \## Developed By
78
+
79
+
80
+
81
+ AI Scholars Final Project
82
+
app.py ADDED
@@ -0,0 +1,454 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from datetime import datetime
3
+
4
+ def study_assistant(subject, goal, time_available, difficulty, learning_style, current_stress):
5
+ if not subject or not goal or not time_available:
6
+ return """
7
+ <div class="result-card warning">
8
+ <h3>Missing Information</h3>
9
+ <p>Please fill in the subject, study goal, and time available.</p>
10
+ </div>
11
+ """
12
+
13
+ try:
14
+ minutes = int(time_available)
15
+ except:
16
+ return """
17
+ <div class="result-card warning">
18
+ <h3>Invalid Time</h3>
19
+ <p>Please enter time available as a number, like 60.</p>
20
+ </div>
21
+ """
22
+
23
+ if minutes < 30:
24
+ plan = "Quick Focus Session"
25
+ breakdown = [
26
+ ("5 min", "Review key notes"),
27
+ ("15 min", "Practice the hardest concept"),
28
+ ("5 min", "Active recall without notes"),
29
+ ("5 min", "Write down what still feels confusing")
30
+ ]
31
+ elif minutes <= 90:
32
+ plan = "Balanced Study Session"
33
+ breakdown = [
34
+ ("10 min", "Review notes and identify weak areas"),
35
+ ("25 min", "Study the main topic deeply"),
36
+ ("25 min", "Practice questions or examples"),
37
+ ("15 min", "Active recall / self-quiz"),
38
+ ("10 min", "Summarize what you learned")
39
+ ]
40
+ else:
41
+ plan = "Deep Study Session"
42
+ breakdown = [
43
+ ("15 min", "Warm-up review"),
44
+ ("40 min", "Learn or relearn difficult material"),
45
+ ("30 min", "Practice questions"),
46
+ ("20 min", "Teach the concept out loud"),
47
+ ("15 min", "Break"),
48
+ ("30 min", "Final review + self-quiz")
49
+ ]
50
+
51
+ difficulty_advice = {
52
+ "Easy": "Use this session to build speed and confidence.",
53
+ "Medium": "Mix review with active practice so you do not just reread notes.",
54
+ "Hard": "Start with the hardest topic first while your brain is fresh."
55
+ }
56
+
57
+ learning_methods = {
58
+ "Visual": "Use diagrams, charts, color-coded notes, and concept maps.",
59
+ "Practice-Based": "Focus on practice problems, quizzes, examples, and repetition.",
60
+ "Verbal": "Explain the topic out loud like you are teaching someone.",
61
+ "Reading/Writing": "Use active recall: close your notes and write what you remember."
62
+ }
63
+
64
+ stress_tips = {
65
+ "Low": "You are in a good place to push for a productive session.",
66
+ "Medium": "Use a timer so the session feels controlled and less overwhelming.",
67
+ "High": "Start with a 2-minute reset. Focus on one small win first."
68
+ }
69
+
70
+ today = datetime.now().strftime("%B %d, %Y")
71
+
72
+ timeline_html = ""
73
+ for time, task in breakdown:
74
+ timeline_html += f"""
75
+ <div class="timeline-item">
76
+ <div class="timeline-time">{time}</div>
77
+ <div class="timeline-task">{task}</div>
78
+ </div>
79
+ """
80
+
81
+ return f"""
82
+ <div class="result-card">
83
+ <div class="result-topline">Personalized Study Plan</div>
84
+
85
+ <h2>{plan}</h2>
86
+
87
+ <div class="summary-grid">
88
+ <div>
89
+ <span class="label">Date</span>
90
+ <strong>{today}</strong>
91
+ </div>
92
+ <div>
93
+ <span class="label">Subject</span>
94
+ <strong>{subject}</strong>
95
+ </div>
96
+ <div>
97
+ <span class="label">Goal</span>
98
+ <strong>{goal}</strong>
99
+ </div>
100
+ <div>
101
+ <span class="label">Time</span>
102
+ <strong>{minutes} minutes</strong>
103
+ </div>
104
+ </div>
105
+
106
+ <h3>Recommended Study Flow</h3>
107
+ <div class="timeline">
108
+ {timeline_html}
109
+ </div>
110
+
111
+ <div class="strategy-box">
112
+ <h3>Best Strategy for You</h3>
113
+ <p><strong>Difficulty:</strong> {difficulty} — {difficulty_advice[difficulty]}</p>
114
+ <p><strong>Learning Style:</strong> {learning_style} — {learning_methods[learning_style]}</p>
115
+ <p><strong>Stress Level:</strong> {current_stress} — {stress_tips[current_stress]}</p>
116
+ </div>
117
+
118
+ <div class="mission-box">
119
+ <h3>Your Mission</h3>
120
+ <ul>
121
+ <li>Explain the main idea without looking at notes</li>
122
+ <li>Answer practice questions with more confidence</li>
123
+ <li>Identify what still needs review</li>
124
+ <li>Create one clear next step for your next session</li>
125
+ </ul>
126
+ </div>
127
+ </div>
128
+ """
129
+
130
+ custom_css = """
131
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
132
+
133
+ :root {
134
+ --navy: #071A33;
135
+ --navy-light: #0B2A50;
136
+ --gold: #D4A017;
137
+ --gold-soft: #FFF7DD;
138
+ --cream: #F8F5EF;
139
+ --text: #111827;
140
+ --muted: #6B7280;
141
+ --border: #E5E7EB;
142
+ }
143
+
144
+ body {
145
+ background: radial-gradient(circle at top left, #EEF4FF 0, #F8F5EF 35%, #FFFFFF 100%) !important;
146
+ font-family: 'Inter', sans-serif !important;
147
+ }
148
+
149
+ .gradio-container {
150
+ max-width: 1220px !important;
151
+ margin: auto !important;
152
+ padding: 36px 20px !important;
153
+ }
154
+
155
+ #hero {
156
+ background: linear-gradient(135deg, var(--navy) 0%, #102B52 60%, #163B6E 100%);
157
+ color: white;
158
+ padding: 44px 48px;
159
+ border-radius: 28px;
160
+ box-shadow: 0 24px 70px rgba(7, 26, 51, 0.22);
161
+ margin-bottom: 28px;
162
+ position: relative;
163
+ overflow: hidden;
164
+ }
165
+
166
+ #hero::after {
167
+ content: "";
168
+ position: absolute;
169
+ width: 320px;
170
+ height: 320px;
171
+ right: -90px;
172
+ top: -110px;
173
+ background: rgba(212, 160, 23, 0.18);
174
+ border-radius: 50%;
175
+ }
176
+
177
+ .hero-badge {
178
+ display: inline-block;
179
+ background: rgba(255,255,255,0.12);
180
+ border: 1px solid rgba(255,255,255,0.22);
181
+ color: #FDE68A;
182
+ padding: 8px 14px;
183
+ border-radius: 999px;
184
+ font-size: 13px;
185
+ font-weight: 700;
186
+ letter-spacing: 0.04em;
187
+ text-transform: uppercase;
188
+ margin-bottom: 18px;
189
+ }
190
+
191
+ .hero-title {
192
+ font-size: 46px;
193
+ line-height: 1.05;
194
+ font-weight: 800;
195
+ margin: 0 0 12px 0;
196
+ max-width: 720px;
197
+
198
+ color: #FFFFFF;
199
+ text-shadow: 0px 2px 12px rgba(0,0,0,0.28);
200
+ }
201
+
202
+ .hero-subtitle {
203
+ color: #DDE7F6;
204
+ font-size: 18px;
205
+ line-height: 1.6;
206
+ max-width: 720px;
207
+ margin: 0;
208
+ }
209
+
210
+ #main-panel {
211
+ background: rgba(255,255,255,0.82);
212
+ border: 1px solid rgba(229,231,235,0.9);
213
+ backdrop-filter: blur(14px);
214
+ border-radius: 28px;
215
+ padding: 28px;
216
+ box-shadow: 0 20px 55px rgba(15,23,42,0.08);
217
+ }
218
+
219
+ .input-card {
220
+ background: white;
221
+ border: 1px solid var(--border);
222
+ border-radius: 24px;
223
+ padding: 24px;
224
+ box-shadow: 0 12px 35px rgba(15, 23, 42, 0.07);
225
+ }
226
+
227
+ .section-title {
228
+ font-size: 22px;
229
+ font-weight: 800;
230
+ color: var(--navy);
231
+ margin-bottom: 4px;
232
+ }
233
+
234
+ .section-subtitle {
235
+ color: var(--muted);
236
+ font-size: 14px;
237
+ margin-bottom: 20px;
238
+ }
239
+
240
+ .gr-textbox, .gr-dropdown {
241
+ border-radius: 14px !important;
242
+ }
243
+
244
+ textarea, input, select {
245
+ border-radius: 14px !important;
246
+ }
247
+
248
+ label {
249
+ color: var(--navy) !important;
250
+ font-weight: 700 !important;
251
+ font-size: 13px !important;
252
+ }
253
+
254
+ button.primary-btn {
255
+ background: linear-gradient(135deg, var(--gold) 0%, #F2C94C 100%) !important;
256
+ color: var(--navy) !important;
257
+ border: none !important;
258
+ border-radius: 16px !important;
259
+ font-weight: 800 !important;
260
+ font-size: 16px !important;
261
+ padding: 14px 18px !important;
262
+ box-shadow: 0 12px 24px rgba(212,160,23,0.28) !important;
263
+ }
264
+
265
+ button.primary-btn:hover {
266
+ transform: translateY(-1px);
267
+ box-shadow: 0 16px 30px rgba(212,160,23,0.35) !important;
268
+ }
269
+
270
+ .output-wrap {
271
+ min-height: 600px;
272
+ }
273
+
274
+ .result-card {
275
+ background: white;
276
+ border-radius: 24px;
277
+ border: 1px solid var(--border);
278
+ padding: 28px;
279
+ box-shadow: 0 16px 45px rgba(15,23,42,0.08);
280
+ color: var(--text);
281
+ }
282
+
283
+ .result-card.warning {
284
+ border-left: 6px solid #D4A017;
285
+ }
286
+
287
+ .result-topline {
288
+ display: inline-block;
289
+ background: var(--gold-soft);
290
+ color: #8A6500;
291
+ font-size: 12px;
292
+ font-weight: 800;
293
+ padding: 7px 12px;
294
+ border-radius: 999px;
295
+ text-transform: uppercase;
296
+ letter-spacing: 0.05em;
297
+ margin-bottom: 12px;
298
+ }
299
+
300
+ .result-card h2 {
301
+ color: var(--navy);
302
+ font-size: 30px;
303
+ margin: 8px 0 20px 0;
304
+ }
305
+
306
+ .result-card h3 {
307
+ color: var(--navy);
308
+ margin-top: 24px;
309
+ margin-bottom: 12px;
310
+ font-size: 18px;
311
+ }
312
+
313
+ .summary-grid {
314
+ display: grid;
315
+ grid-template-columns: repeat(2, 1fr);
316
+ gap: 14px;
317
+ margin: 18px 0 22px 0;
318
+ }
319
+
320
+ .summary-grid div {
321
+ background: #F8FAFC;
322
+ border: 1px solid var(--border);
323
+ border-radius: 16px;
324
+ padding: 14px;
325
+ }
326
+
327
+ .label {
328
+ display: block;
329
+ color: var(--muted);
330
+ font-size: 12px;
331
+ font-weight: 700;
332
+ margin-bottom: 5px;
333
+ text-transform: uppercase;
334
+ letter-spacing: 0.04em;
335
+ }
336
+
337
+ .timeline {
338
+ border-left: 3px solid var(--gold);
339
+ padding-left: 18px;
340
+ }
341
+
342
+ .timeline-item {
343
+ display: flex;
344
+ gap: 14px;
345
+ align-items: flex-start;
346
+ margin-bottom: 12px;
347
+ }
348
+
349
+ .timeline-time {
350
+ min-width: 70px;
351
+ color: var(--navy);
352
+ font-weight: 800;
353
+ }
354
+
355
+ .timeline-task {
356
+ color: #374151;
357
+ }
358
+
359
+ .strategy-box, .mission-box {
360
+ background: #F8FAFC;
361
+ border: 1px solid var(--border);
362
+ border-radius: 18px;
363
+ padding: 18px;
364
+ margin-top: 18px;
365
+ }
366
+
367
+ .mission-box ul {
368
+ margin: 0;
369
+ padding-left: 20px;
370
+ }
371
+
372
+ .mission-box li {
373
+ margin-bottom: 8px;
374
+ }
375
+
376
+ .footer-note {
377
+ text-align: center;
378
+ color: var(--muted);
379
+ font-size: 13px;
380
+ margin-top: 20px;
381
+ }
382
+
383
+ @media (max-width: 800px) {
384
+ .hero-title {
385
+ font-size: 34px;
386
+ }
387
+
388
+ #hero {
389
+ padding: 34px 28px;
390
+ }
391
+
392
+ .summary-grid {
393
+ grid-template-columns: 1fr;
394
+ }
395
+ }
396
+ """
397
+
398
+ with gr.Blocks(
399
+ css=custom_css,
400
+ title="AI Study Assistant | AI-Scholars Final Project"
401
+ ) as app:
402
+ gr.HTML("""
403
+ <div id="hero">
404
+ <div class="hero-badge">AI Study Assistant | AI-Scholars Final Project</div>
405
+ <h1 class="hero-title">Plan smarter study sessions in seconds.</h1>
406
+ <p class="hero-subtitle">
407
+ Build a personalized study plan based on your subject, goal, time, difficulty,
408
+ learning style, and stress level — designed to help students stay focused and get better results.
409
+ </p>
410
+ </div>
411
+ """)
412
+
413
+ with gr.Row(elem_id="main-panel"):
414
+ with gr.Column(scale=1):
415
+ gr.HTML("""
416
+ <div class="input-card">
417
+ <div class="section-title">Create Your Study Plan</div>
418
+ <div class="section-subtitle">Enter a few details and get a focused, step-by-step session plan.</div>
419
+ """)
420
+ subject = gr.Textbox(label="Subject", placeholder="Biology, Math, History, Chemistry")
421
+ goal = gr.Textbox(label="Study Goal", placeholder="Prepare for quiz on photosynthesis")
422
+ time_available = gr.Textbox(label="Time Available", placeholder="60")
423
+ difficulty = gr.Dropdown(["Easy", "Medium", "Hard"], label="Difficulty Level", value="Medium")
424
+ learning_style = gr.Dropdown(
425
+ ["Visual", "Practice-Based", "Verbal", "Reading/Writing"],
426
+ label="Learning Style",
427
+ value="Practice-Based"
428
+ )
429
+ current_stress = gr.Dropdown(["Low", "Medium", "High"], label="Stress Level", value="Medium")
430
+ submit = gr.Button("Generate Study Plan", elem_classes="primary-btn")
431
+ gr.HTML("</div>")
432
+
433
+ with gr.Column(scale=1, elem_classes="output-wrap"):
434
+ output = gr.HTML("""
435
+ <div class="result-card">
436
+ <div class="result-topline">Your plan will appear here</div>
437
+ <h2>Ready when you are.</h2>
438
+ <p>Fill in the form and generate a personalized study plan built around your time, goal, and learning style.</p>
439
+ </div>
440
+ """)
441
+
442
+ gr.HTML("""
443
+ <div class="footer-note">
444
+ Built for students who want structure, focus, and better study results.
445
+ </div>
446
+ """)
447
+
448
+ submit.click(
449
+ study_assistant,
450
+ inputs=[subject, goal, time_available, difficulty, learning_style, current_stress],
451
+ outputs=output
452
+ )
453
+
454
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio
screenshot.png ADDED

Git LFS Details

  • SHA256: 32557f9ca75377a9dc1026e6f6fcadc27d7327c6886d2906fbca7c0e068f70f4
  • Pointer size: 131 Bytes
  • Size of remote file: 303 kB