PraneshJs commited on
Commit
8a84b70
·
verified ·
1 Parent(s): f85354a

fixed expected 1 but got 0 and keyError 6 also added new ui and scrollable

Browse files
Files changed (1) hide show
  1. app.py +184 -151
app.py CHANGED
@@ -77,20 +77,21 @@ def extract_subjects_and_marks_for_gradio(roll_no):
77
  headers = studentwise_data[0]
78
  roll_no = roll_no.strip().upper()
79
 
80
- # Find the student row using cached data
81
  student_row = None
82
  for row in studentwise_data[1:]: # Skip header row
83
- # Check multiple possible roll number columns (0, 1, 2)
84
- for col_idx in [0, 1, 2]:
85
- if col_idx < len(row) and row[col_idx].strip().upper() == roll_no:
86
  student_row = row
87
  break
88
- if student_row:
89
  break
90
-
91
- if not student_row:
92
  return f"❌ Student with Roll No '{roll_no}' not found."
93
 
 
94
  def get_value_if_not_empty(col_name):
95
  """Helper function to get value only if it's not empty"""
96
  if col_name in headers:
@@ -142,154 +143,150 @@ def extract_subjects_and_marks_for_gradio(roll_no):
142
  subject['total_marks'] = subject['ip1_marks'] + subject['ip2_marks']
143
 
144
  # Calculate grand totals
145
- total_theory_ip1 = sum(s['ip1_points'] for s in theory_subjects)
146
- total_theory_ip2 = sum(s['ip2_points'] for s in theory_subjects)
147
- total_lab_ip1 = sum(s['ip1_points'] for s in lab_subjects)
148
- total_lab_ip2 = sum(s['ip2_points'] for s in lab_subjects)
149
-
150
- grand_total_ip1 = total_theory_ip1 + total_lab_ip1
151
- grand_total_ip2 = total_theory_ip2 + total_lab_ip2
152
- grand_total_points = grand_total_ip1 + grand_total_ip2
153
-
154
- # Calculate marks totals
155
- total_theory_marks_ip1 = sum(s['ip1_marks'] for s in theory_subjects)
156
- total_theory_marks_ip2 = sum(s['ip2_marks'] for s in theory_subjects)
157
- total_lab_marks_ip1 = sum(s['ip1_marks'] for s in lab_subjects)
158
- total_lab_marks_ip2 = sum(s['ip2_marks'] for s in lab_subjects)
159
 
160
- grand_total_marks_ip1 = total_theory_marks_ip1 + total_lab_marks_ip1
161
- grand_total_marks_ip2 = total_theory_marks_ip2 + total_lab_marks_ip2
162
- grand_total_marks = grand_total_marks_ip1 + grand_total_marks_ip2
163
-
164
- total_subjects = len(theory_subjects) + len(lab_subjects)
165
-
166
- # SIMPLE TABLE FORMATTING WITHOUT CONFUSING SYMBOLS
167
- def format_table_row(subject, ip1, ip2, total):
168
- """Format a table row with clean alignment"""
169
- # Fixed column widths
170
- subject_col = 48
171
- ip1_col = 10
172
- ip2_col = 10
173
- total_col = 12
174
-
175
- # Format subject column (left-aligned)
176
- subject_str = str(subject)[:subject_col].ljust(subject_col)
177
-
178
- # Format numeric columns (right-aligned with fixed width)
179
- ip1_str = str(ip1).rjust(ip1_col)
180
- ip2_str = str(ip2).rjust(ip2_col)
181
- total_str = str(total).rjust(total_col)
182
-
183
- return f"{subject_str} {ip1_str} {ip2_str} {total_str}"
184
 
185
- # Build output with clean formatting
186
  output = []
187
  output.append("")
188
- output.append("🏆 REWARD POINTS DISTRIBUTION")
189
- output.append("-" * 88)
190
-
191
- # Header row
192
- header_row = format_table_row("SUBJECTS", "IP - 1", "IP - 2", "TOTAL")
193
- output.append(header_row)
194
- output.append("-" * 88)
195
 
196
- # Theory courses section
197
  if theory_subjects:
198
- theory_header = format_table_row(f"THEORY COURSES - ({len(theory_subjects)} COURSES)", "", "", "")
199
- output.append(theory_header)
200
 
201
  for subject in theory_subjects:
202
- ip1_val = f"{subject['ip1_points']:.2f}" if subject['ip1_points'] > 0 else ""
203
- ip2_val = f"{subject['ip2_points']:.2f}" if subject['ip2_points'] > 0 else ""
204
- total_val = f"{subject['total_points']:.2f}"
205
- subject_row = format_table_row(subject['code'], ip1_val, ip2_val, total_val)
206
- output.append(subject_row)
207
-
208
- # Add-on courses
209
- addon_row = format_table_row("ADD-ON / HONOR / MINOR COURSES", "", "", "")
210
- output.append(addon_row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
- # Lab courses section
213
  if lab_subjects:
214
- lab_header = format_table_row(f"LAB. COURSES - ({len(lab_subjects)} COURSES)", "", "", "")
215
- output.append(lab_header)
216
 
217
  for subject in lab_subjects:
218
- ip1_val = f"{subject['ip1_points']:.2f}" if subject['ip1_points'] > 0 else ""
219
- ip2_val = f"{subject['ip2_points']:.2f}" if subject['ip2_points'] > 0 else ""
220
- total_val = f"{subject['total_points']:.2f}"
221
- subject_row = format_table_row(subject['code'], ip1_val, ip2_val, total_val)
222
- output.append(subject_row)
223
- else:
224
- lab_header = format_table_row("LAB. COURSES - (0 COURSES)", "", "", "")
225
- output.append(lab_header)
226
-
227
- # Total row
228
- grand_ip1_val = f"{grand_total_ip1:,.2f}" if grand_total_ip1 > 0 else "0.00"
229
- grand_ip2_val = f"{grand_total_ip2:,.2f}" if grand_total_ip2 > 0 else "0.00"
230
- grand_total_val = f"{grand_total_points:,.2f}"
231
- total_row = format_table_row(f"TOTAL - ({total_subjects} SUBJECTS)", grand_ip1_val, grand_ip2_val, grand_total_val)
232
- output.append("-" * 88)
233
- output.append(total_row)
234
-
235
- output.append("")
236
-
237
- # INTERNAL MARKS DISTRIBUTION
238
- output.append("🎯 INTERNAL MARKS DISTRIBUTION")
239
- output.append("-" * 88)
 
 
 
 
 
240
 
241
- # Header for marks
242
- marks_header = format_table_row("SUBJECTS", "IP - 1", "IP - 2", "TOTAL")
243
- output.append(marks_header)
244
- output.append("-" * 88)
245
 
246
- # Theory courses with marks
 
247
  if theory_subjects:
248
- theory_marks_header = format_table_row(f"THEORY COURSES - ({len(theory_subjects)} COURSES)", "", "", "")
249
- output.append(theory_marks_header)
250
-
251
- for subject in theory_subjects:
252
- ip1_marks = f"{subject['ip1_marks']:.2f}" if subject['ip1_marks'] > 0 else ""
253
- ip2_marks = f"{subject['ip2_marks']:.2f}" if subject['ip2_marks'] > 0 else ""
254
- total_marks = f"{subject['total_marks']:.2f}"
255
- marks_row = format_table_row(subject['code'], ip1_marks, ip2_marks, total_marks)
256
- output.append(marks_row)
257
 
258
- # Add-on courses with marks
259
- addon_marks_row = format_table_row("ADD-ON / HONOR / MINOR COURSES", "", "", "")
260
- output.append(addon_marks_row)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
 
262
- # Lab courses with marks
263
  if lab_subjects:
264
- lab_marks_header = format_table_row(f"LAB. COURSES - ({len(lab_subjects)} COURSES)", "", "", "")
265
- output.append(lab_marks_header)
266
-
267
- for subject in lab_subjects:
268
- ip1_marks = f"{subject['ip1_marks']:.2f}" if subject['ip1_marks'] > 0 else ""
269
- ip2_marks = f"{subject['ip2_marks']:.2f}" if subject['ip2_marks'] > 0 else ""
270
- total_marks = f"{subject['total_marks']:.2f}"
271
- marks_row = format_table_row(subject['code'], ip1_marks, ip2_marks, total_marks)
272
- output.append(marks_row)
273
- else:
274
- lab_marks_header = format_table_row("LAB. COURSES - (0 COURSES)", "", "", "")
275
- output.append(lab_marks_header)
276
 
277
- # Total marks row
278
- marks_ip1_total = f"{grand_total_marks_ip1:.2f}" if grand_total_marks_ip1 > 0 else "0.00"
279
- marks_ip2_total = f"{grand_total_marks_ip2:.2f}" if grand_total_marks_ip2 > 0 else "0.00"
280
- marks_total_total = f"{grand_total_marks:.2f}"
281
- marks_total_row = format_table_row(f"TOTAL - ({total_subjects} SUBJECTS)", marks_ip1_total, marks_ip2_total, marks_total_total)
282
- output.append("-" * 88)
283
- output.append(marks_total_row)
284
 
285
- output.append("=" * 88)
286
 
287
  # Log the search
288
  now_ist = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S")
289
  print(f"IP Details Searched - Roll No: {roll_no} | Student: {student_name} | Time (IST): {now_ist}")
290
 
291
  return "\n".join(output)
292
-
293
  except Exception as e:
294
  error_msg = f"❌ Error extracting subject details: {str(e)}"
295
  print(error_msg)
@@ -1248,12 +1245,13 @@ with gr.Blocks(
1248
  title="Student Reward Points Check",
1249
  theme=gr.themes.Soft(),
1250
  ) as app:
1251
- gr.Markdown("# 🎓 Student Reward Points Checker")
1252
- gr.Markdown("### Search for Student Details such as Reward Points, Redemption Dates and Innovative Practice (IP) Details")
1253
- gr.Markdown("### எல்லா புகழும் இறைவனுக்கே ✝ 🕉 ☪")
1254
- gr.Markdown("## 📝 Use Desktop Site Feature (Desktop Mode) in browser for Good UI and UX")
1255
  gr.Markdown("🕒 **Auto-Updates**: Data automatically refreshes when there is a change in Reward Points Sheet")
1256
- gr.Markdown("### Fill this form for any Issue/Feedback: [Issue/Feedback Form](https://docs.google.com/forms/d/e/1FAIpQLScnl0udcN2pUDENHl45HIj5HZbvDuwZ0g2eepBbp8tJYg-NvQ/viewform)")
 
1257
  with gr.Tabs():
1258
  with gr.TabItem("🔍 Student Search"):
1259
  with gr.Row():
@@ -1287,14 +1285,17 @@ with gr.Blocks(
1287
 
1288
  subject_output = gr.Textbox(
1289
  label="Innovative Practice (IP) Details",
1290
- lines=65,
1291
- max_lines=75,
1292
  show_copy_button=True,
1293
  autoscroll=False
1294
  )
1295
 
1296
  with gr.TabItem("ℹ️ System Information"):
1297
- system_btn = gr.Button("📊 Get System Information", variant="secondary")
 
 
 
1298
  system_output = gr.Textbox(
1299
  label="System Information",
1300
  lines=50,
@@ -1305,15 +1306,45 @@ with gr.Blocks(
1305
  show_label=True
1306
  )
1307
 
1308
- # Event handlers
1309
- search_btn.click(fn=search_student, inputs=roll_input, outputs=result_output)
1310
- roll_input.submit(fn=search_student, inputs=roll_input, outputs=result_output)
1311
 
1312
- # NEW: Subject details event handlers
1313
- subject_search_btn.click(fn=extract_subjects_and_marks_for_gradio, inputs=subject_roll_input, outputs=subject_output)
1314
- subject_roll_input.submit(fn=extract_subjects_and_marks_for_gradio, inputs=subject_roll_input, outputs=subject_output)
 
 
 
 
1315
 
1316
- system_btn.click(fn=get_system_info, outputs=system_output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1317
 
1318
  # Footer section
1319
  gr.Markdown("---")
@@ -1323,7 +1354,7 @@ with gr.Blocks(
1323
  """
1324
  <div style="text-align: center; margin-top: 20px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 10px; color: white;">
1325
  <h3 style="margin: 0; color: white;">💻 Developed with ❤️ by</h3>
1326
- <a href="https://praneshjs.vercel.app/" target="_blank" style="text-decoration: none;">
1327
  <h2 style="margin: 5px 0; color: #ffd700; cursor: pointer; transition: color 0.3s ease;">PRANESH S</h2>
1328
  </a>
1329
  <div style="margin: 15px 0;">
@@ -1346,19 +1377,21 @@ with gr.Blocks(
1346
  elem_id="footer"
1347
  )
1348
 
1349
- # System info initialization function
1350
  def initialize_system_info():
1351
- """Initialize system information display"""
1352
  try:
1353
  return get_system_info()
1354
  except Exception as e:
1355
- print(f"⚠️ Error initializing system info: {str(e)}")
1356
- return "⚠️ System information will be available after data loads completely."
 
1357
 
1358
- # Load system info on startup
1359
  app.load(
1360
  fn=initialize_system_info,
1361
- outputs=system_output
 
1362
  )
1363
 
1364
  # Launch the app
 
77
  headers = studentwise_data[0]
78
  roll_no = roll_no.strip().upper()
79
 
80
+ # Replace indexing with loop search:
81
  student_row = None
82
  for row in studentwise_data[1:]: # Skip header row
83
+ # Check multiple columns for roll number
84
+ for i, cell in enumerate(row[:5]): # Check first 5 columns
85
+ if cell.strip().upper() == roll_no:
86
  student_row = row
87
  break
88
+ if student_row is not None:
89
  break
90
+
91
+ if student_row is None:
92
  return f"❌ Student with Roll No '{roll_no}' not found."
93
 
94
+ # Rest of the function remains the same...
95
  def get_value_if_not_empty(col_name):
96
  """Helper function to get value only if it's not empty"""
97
  if col_name in headers:
 
143
  subject['total_marks'] = subject['ip1_marks'] + subject['ip2_marks']
144
 
145
  # Calculate grand totals
146
+ total_theory_ip1_points = sum(s['ip1_points'] for s in theory_subjects)
147
+ total_theory_ip2_points = sum(s['ip2_points'] for s in theory_subjects)
148
+ total_lab_ip1_points = sum(s['ip1_points'] for s in lab_subjects)
149
+ total_lab_ip2_points = sum(s['ip2_points'] for s in lab_subjects)
 
 
 
 
 
 
 
 
 
 
150
 
151
+ total_theory_ip1_marks = sum(s['ip1_marks'] for s in theory_subjects)
152
+ total_theory_ip2_marks = sum(s['ip2_marks'] for s in theory_subjects)
153
+ total_lab_ip1_marks = sum(s['ip1_marks'] for s in lab_subjects)
154
+ total_lab_ip2_marks = sum(s['ip2_marks'] for s in lab_subjects)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
+ # Build output with clean card-style formatting
157
  output = []
158
  output.append("")
159
+ output.append("🏆 INNOVATIVE PRACTICE (IP) SUMMARY")
160
+ output.append("=" * 80)
 
 
 
 
 
161
 
162
+ # Theory subjects section
163
  if theory_subjects:
164
+ output.append(f"\n📚 THEORY SUBJECTS ({len(theory_subjects)} subjects)")
165
+ output.append("-" * 50)
166
 
167
  for subject in theory_subjects:
168
+ output.append(f"\n🔹 {subject['code']}")
169
+
170
+ # Points section
171
+ if subject['ip1_points'] > 0 or subject['ip2_points'] > 0:
172
+ points_line = " Reward Points: "
173
+ if subject['ip1_points'] > 0:
174
+ points_line += f"IP-1: {subject['ip1_points']:.2f}"
175
+ if subject['ip2_points'] > 0:
176
+ if subject['ip1_points'] > 0:
177
+ points_line += f" | IP-2: {subject['ip2_points']:.2f}"
178
+ else:
179
+ points_line += f"IP-2: {subject['ip2_points']:.2f}"
180
+ points_line += f" | Total: {subject['total_points']:.2f}"
181
+ output.append(points_line)
182
+
183
+ # Marks section
184
+ if subject['ip1_marks'] > 0 or subject['ip2_marks'] > 0:
185
+ marks_line = " Internal Marks: "
186
+ if subject['ip1_marks'] > 0:
187
+ marks_line += f"IP-1: {subject['ip1_marks']:.2f}"
188
+ if subject['ip2_marks'] > 0:
189
+ if subject['ip1_marks'] > 0:
190
+ marks_line += f" | IP-2: {subject['ip2_marks']:.2f}"
191
+ else:
192
+ marks_line += f"IP-2: {subject['ip2_marks']:.2f}"
193
+ marks_line += f" | Total: {subject['total_marks']:.2f}"
194
+ output.append(marks_line)
195
 
196
+ # Lab subjects section
197
  if lab_subjects:
198
+ output.append(f"\n🧪 LAB SUBJECTS ({len(lab_subjects)} subjects)")
199
+ output.append("-" * 50)
200
 
201
  for subject in lab_subjects:
202
+ output.append(f"\n🔹 {subject['code']}")
203
+
204
+ # Points section
205
+ if subject['ip1_points'] > 0 or subject['ip2_points'] > 0:
206
+ points_line = " Reward Points: "
207
+ if subject['ip1_points'] > 0:
208
+ points_line += f"IP-1: {subject['ip1_points']:.2f}"
209
+ if subject['ip2_points'] > 0:
210
+ if subject['ip1_points'] > 0:
211
+ points_line += f" | IP-2: {subject['ip2_points']:.2f}"
212
+ else:
213
+ points_line += f"IP-2: {subject['ip2_points']:.2f}"
214
+ points_line += f" | Total: {subject['total_points']:.2f}"
215
+ output.append(points_line)
216
+
217
+ # Marks section
218
+ if subject['ip1_marks'] > 0 or subject['ip2_marks'] > 0:
219
+ marks_line = " Internal Marks: "
220
+ if subject['ip1_marks'] > 0:
221
+ marks_line += f"IP-1: {subject['ip1_marks']:.2f}"
222
+ if subject['ip2_marks'] > 0:
223
+ if subject['ip1_marks'] > 0:
224
+ marks_line += f" | IP-2: {subject['ip2_marks']:.2f}"
225
+ else:
226
+ marks_line += f"IP-2: {subject['ip2_marks']:.2f}"
227
+ marks_line += f" | Total: {subject['total_marks']:.2f}"
228
+ output.append(marks_line)
229
 
230
+ # Summary section
231
+ output.append("\n" + "=" * 80)
232
+ output.append("📊 OVERALL SUMMARY")
233
+ output.append("=" * 80)
234
 
235
+ # Reward Points Summary
236
+ output.append("\n🏅 REWARD POINTS BREAKDOWN:")
237
  if theory_subjects:
238
+ theory_total = total_theory_ip1_points + total_theory_ip2_points
239
+ output.append(f" Theory Subjects: {theory_total:.2f} points")
240
+ if total_theory_ip1_points > 0:
241
+ output.append(f" ➤ IP-1: {total_theory_ip1_points:.2f}")
242
+ if total_theory_ip2_points > 0:
243
+ output.append(f" ➤ IP-2: {total_theory_ip2_points:.2f}")
 
 
 
244
 
245
+ if lab_subjects:
246
+ lab_total = total_lab_ip1_points + total_lab_ip2_points
247
+ output.append(f" Lab Subjects: {lab_total:.2f} points")
248
+ if total_lab_ip1_points > 0:
249
+ output.append(f" ➤ IP-1: {total_lab_ip1_points:.2f}")
250
+ if total_lab_ip2_points > 0:
251
+ output.append(f" ➤ IP-2: {total_lab_ip2_points:.2f}")
252
+
253
+ grand_total_points = (total_theory_ip1_points + total_theory_ip2_points +
254
+ total_lab_ip1_points + total_lab_ip2_points)
255
+ output.append(f"\n🎯 TOTAL REWARD POINTS: {grand_total_points:.2f}")
256
+
257
+ # Internal Marks Summary
258
+ output.append("\n📝 INTERNAL MARKS BREAKDOWN:")
259
+ if theory_subjects:
260
+ theory_marks_total = total_theory_ip1_marks + total_theory_ip2_marks
261
+ output.append(f" Theory Subjects: {theory_marks_total:.2f} marks")
262
+ if total_theory_ip1_marks > 0:
263
+ output.append(f" ➤ IP-1: {total_theory_ip1_marks:.2f}")
264
+ if total_theory_ip2_marks > 0:
265
+ output.append(f" ➤ IP-2: {total_theory_ip2_marks:.2f}")
266
 
 
267
  if lab_subjects:
268
+ lab_marks_total = total_lab_ip1_marks + total_lab_ip2_marks
269
+ output.append(f" Lab Subjects: {lab_marks_total:.2f} marks")
270
+ if total_lab_ip1_marks > 0:
271
+ output.append(f" ➤ IP-1: {total_lab_ip1_marks:.2f}")
272
+ if total_lab_ip2_marks > 0:
273
+ output.append(f" ➤ IP-2: {total_lab_ip2_marks:.2f}")
274
+
275
+ grand_total_marks = (total_theory_ip1_marks + total_theory_ip2_marks +
276
+ total_lab_ip1_marks + total_lab_ip2_marks)
277
+ output.append(f"\n📊 TOTAL INTERNAL MARKS: {grand_total_marks:.2f}")
 
 
278
 
279
+ total_subjects = len(theory_subjects) + len(lab_subjects)
280
+ output.append(f"\n📚 TOTAL SUBJECTS: {total_subjects}")
 
 
 
 
 
281
 
282
+ output.append("\n" + "=" * 80)
283
 
284
  # Log the search
285
  now_ist = datetime.now(ist).strftime("%Y-%m-%d %H:%M:%S")
286
  print(f"IP Details Searched - Roll No: {roll_no} | Student: {student_name} | Time (IST): {now_ist}")
287
 
288
  return "\n".join(output)
289
+
290
  except Exception as e:
291
  error_msg = f"❌ Error extracting subject details: {str(e)}"
292
  print(error_msg)
 
1245
  title="Student Reward Points Check",
1246
  theme=gr.themes.Soft(),
1247
  ) as app:
1248
+ gr.Markdown("## 🎓 Student Reward Points Checker")
1249
+ gr.Markdown("##### Search for Student Details such as Reward Points, Redemption Dates and Innovative Practice (IP) Details")
1250
+ gr.Markdown("##### எல்லா புகழும் இறைவனுக்கே ✝ 🕉 ☪")
1251
+ gr.Markdown("💻 **Mode**: Use Desktop Mode in browser for Good UI and UX")
1252
  gr.Markdown("🕒 **Auto-Updates**: Data automatically refreshes when there is a change in Reward Points Sheet")
1253
+ gr.Markdown("📝 **Issue/Feedback Form** : [Issue/Feedback Form](https://docs.google.com/forms/d/e/1FAIpQLScnl0udcN2pUDENHl45HIj5HZbvDuwZ0g2eepBbp8tJYg-NvQ/viewform)")
1254
+
1255
  with gr.Tabs():
1256
  with gr.TabItem("🔍 Student Search"):
1257
  with gr.Row():
 
1285
 
1286
  subject_output = gr.Textbox(
1287
  label="Innovative Practice (IP) Details",
1288
+ lines=50,
1289
+ max_lines=60,
1290
  show_copy_button=True,
1291
  autoscroll=False
1292
  )
1293
 
1294
  with gr.TabItem("ℹ️ System Information"):
1295
+ with gr.Row():
1296
+ with gr.Column():
1297
+ system_btn = gr.Button("📊 Get System Information", variant="secondary", size="lg")
1298
+
1299
  system_output = gr.Textbox(
1300
  label="System Information",
1301
  lines=50,
 
1306
  show_label=True
1307
  )
1308
 
1309
+ # Event handlers - Fixed order and proper input/output mapping
 
 
1310
 
1311
+ # 1. Student search handlers
1312
+ search_btn.click(
1313
+ fn=search_student,
1314
+ inputs=[roll_input],
1315
+ outputs=[result_output],
1316
+ api_name="search_student"
1317
+ )
1318
 
1319
+ roll_input.submit(
1320
+ fn=search_student,
1321
+ inputs=[roll_input],
1322
+ outputs=[result_output],
1323
+ api_name="search_student_submit"
1324
+ )
1325
+
1326
+ # 2. IP Details handlers - Fixed input parameter
1327
+ subject_search_btn.click(
1328
+ fn=extract_subjects_and_marks_for_gradio,
1329
+ inputs=[subject_roll_input],
1330
+ outputs=[subject_output],
1331
+ api_name="get_ip_details"
1332
+ )
1333
+
1334
+ subject_roll_input.submit(
1335
+ fn=extract_subjects_and_marks_for_gradio,
1336
+ inputs=[subject_roll_input],
1337
+ outputs=[subject_output],
1338
+ api_name="get_ip_details_submit"
1339
+ )
1340
+
1341
+ # 3. System info handler - Fixed to not require inputs
1342
+ system_btn.click(
1343
+ fn=get_system_info,
1344
+ inputs=[],
1345
+ outputs=[system_output],
1346
+ api_name="get_system_info"
1347
+ )
1348
 
1349
  # Footer section
1350
  gr.Markdown("---")
 
1354
  """
1355
  <div style="text-align: center; margin-top: 20px; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 10px; color: white;">
1356
  <h3 style="margin: 0; color: white;">💻 Developed with ❤️ by</h3>
1357
+ <a href="https://pranesh-2005.github.io/My-Portfolio/" target="_blank" style="text-decoration: none;">
1358
  <h2 style="margin: 5px 0; color: #ffd700; cursor: pointer; transition: color 0.3s ease;">PRANESH S</h2>
1359
  </a>
1360
  <div style="margin: 15px 0;">
 
1377
  elem_id="footer"
1378
  )
1379
 
1380
+ # System info initialization function - Fixed to handle errors gracefully
1381
  def initialize_system_info():
1382
+ """Initialize system information display with error handling"""
1383
  try:
1384
  return get_system_info()
1385
  except Exception as e:
1386
+ error_msg = f"⚠️ Error initializing system info: {str(e)}"
1387
+ print(error_msg)
1388
+ return "⚠️ System information will be available after data loads completely. Please click 'Get System Information' button to retry."
1389
 
1390
+ # Load system info on startup - Fixed to use proper event handling
1391
  app.load(
1392
  fn=initialize_system_info,
1393
+ inputs=[],
1394
+ outputs=[system_output]
1395
  )
1396
 
1397
  # Launch the app