Dannyar608 commited on
Commit
e7a939b
·
verified ·
1 Parent(s): f640af2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -1396,16 +1396,17 @@ def create_interface():
1396
  gr.update(elem_classes="completed-tab"),
1397
  gr.update(interactive=True),
1398
  gr.update(visible=False)
 
1399
  except Exception as e:
1400
  logging.error(f"Upload error: {str(e)}")
1401
- return (
1402
- f"Error processing transcript: {str(e)}",
1403
- None,
1404
- current_tab_status,
1405
- gr.update(),
1406
- gr.update(),
1407
- gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>")
1408
- )
1409
 
1410
  upload_btn.click(
1411
  fn=process_transcript_and_update,
@@ -1470,6 +1471,7 @@ def create_interface():
1470
  gr.update(interactive=True),
1471
  gr.update(value="<div class='alert-box'>Quiz submitted successfully! Scroll down to view your results.</div>", visible=True),
1472
  gr.update(visible=False)
 
1473
  except Exception as e:
1474
  logging.error(f"Quiz error: {str(e)}")
1475
  return (
@@ -1479,7 +1481,8 @@ def create_interface():
1479
  gr.update(),
1480
  gr.update(),
1481
  gr.update(value=f"<div class='nav-message'>Error: {str(e)}</div>", visible=True),
1482
- gr.update(visible=False))
 
1483
 
1484
  quiz_submit.click(
1485
  fn=submit_quiz_and_update,
@@ -1548,14 +1551,16 @@ def create_interface():
1548
  gr.update(elem_classes="completed-tab"),
1549
  gr.update(interactive=True),
1550
  gr.update(value="<div class='alert-box'>Information saved!</div>", visible=True),
1551
- gr.update(visible=False))
 
1552
  except Exception as e:
1553
  return (
1554
  current_tab_status,
1555
  gr.update(),
1556
  gr.update(),
1557
  gr.update(visible=False),
1558
- gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>"))
 
1559
 
1560
  save_personal_btn.click(
1561
  fn=save_personal_info,
@@ -1610,7 +1615,8 @@ def create_interface():
1610
  new_status,
1611
  gr.update(elem_classes="completed-tab"),
1612
  gr.update(interactive=True),
1613
- gr.update(visible=False))
 
1614
  except Exception as e:
1615
  logging.error(f"Save profile error: {str(e)}")
1616
  return (
@@ -1618,7 +1624,8 @@ def create_interface():
1618
  current_tab_status,
1619
  gr.update(),
1620
  gr.update(),
1621
- gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>"))
 
1622
 
1623
  save_btn.click(
1624
  fn=save_profile_and_update,
@@ -1784,3 +1791,4 @@ app = create_interface()
1784
  # For Hugging Face Spaces deployment
1785
  if __name__ == "__main__":
1786
  app.launch()
 
 
1396
  gr.update(elem_classes="completed-tab"),
1397
  gr.update(interactive=True),
1398
  gr.update(visible=False)
1399
+ )
1400
  except Exception as e:
1401
  logging.error(f"Upload error: {str(e)}")
1402
+ return (
1403
+ f"Error processing transcript: {str(e)}",
1404
+ None,
1405
+ current_tab_status,
1406
+ gr.update(),
1407
+ gr.update(),
1408
+ gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>")
1409
+ )
1410
 
1411
  upload_btn.click(
1412
  fn=process_transcript_and_update,
 
1471
  gr.update(interactive=True),
1472
  gr.update(value="<div class='alert-box'>Quiz submitted successfully! Scroll down to view your results.</div>", visible=True),
1473
  gr.update(visible=False)
1474
+ )
1475
  except Exception as e:
1476
  logging.error(f"Quiz error: {str(e)}")
1477
  return (
 
1481
  gr.update(),
1482
  gr.update(),
1483
  gr.update(value=f"<div class='nav-message'>Error: {str(e)}</div>", visible=True),
1484
+ gr.update(visible=False)
1485
+ )
1486
 
1487
  quiz_submit.click(
1488
  fn=submit_quiz_and_update,
 
1551
  gr.update(elem_classes="completed-tab"),
1552
  gr.update(interactive=True),
1553
  gr.update(value="<div class='alert-box'>Information saved!</div>", visible=True),
1554
+ gr.update(visible=False)
1555
+ )
1556
  except Exception as e:
1557
  return (
1558
  current_tab_status,
1559
  gr.update(),
1560
  gr.update(),
1561
  gr.update(visible=False),
1562
+ gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>")
1563
+ )
1564
 
1565
  save_personal_btn.click(
1566
  fn=save_personal_info,
 
1615
  new_status,
1616
  gr.update(elem_classes="completed-tab"),
1617
  gr.update(interactive=True),
1618
+ gr.update(visible=False)
1619
+ )
1620
  except Exception as e:
1621
  logging.error(f"Save profile error: {str(e)}")
1622
  return (
 
1624
  current_tab_status,
1625
  gr.update(),
1626
  gr.update(),
1627
+ gr.update(visible=True, value=f"<div class='nav-message'>Error: {str(e)}</div>")
1628
+ )
1629
 
1630
  save_btn.click(
1631
  fn=save_profile_and_update,
 
1791
  # For Hugging Face Spaces deployment
1792
  if __name__ == "__main__":
1793
  app.launch()
1794
+