capradeepgujaran commited on
Commit
9ccf273
·
verified ·
1 Parent(s): 55cea31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -24
app.py CHANGED
@@ -744,24 +744,7 @@ def create_quiz_interface():
744
  """Navigate to Get Certified tab"""
745
  return gr.update(selected=2)
746
 
747
- # Event handlers
748
- generate_btn.click(
749
- fn=on_generate_questions,
750
- inputs=[text_input, num_questions],
751
- outputs=[
752
- question_display,
753
- current_options,
754
- question_counter,
755
- question_box,
756
- current_questions,
757
- current_question_idx,
758
- answer_state,
759
- tabs,
760
- results_group,
761
- view_cert_btn
762
- ]
763
- )
764
-
765
  # Fix View Certificate navigation
766
  view_cert_btn.click(
767
  fn=goto_certificate,
@@ -896,8 +879,8 @@ def create_quiz_interface():
896
  results_group,
897
  view_cert_btn
898
  ]
899
- ).then(
900
- lambda: gr.update(selected=1), # Navigate to Take Assessment tab
901
  outputs=tabs
902
  )
903
 
@@ -918,7 +901,6 @@ def create_quiz_interface():
918
  question_box
919
  ]
920
  )
921
-
922
  next_btn.click(
923
  fn=handle_next,
924
  inputs=[
@@ -943,6 +925,7 @@ def create_quiz_interface():
943
  outputs=answer_state
944
  )
945
 
 
946
  submit_btn.click(
947
  fn=on_submit,
948
  inputs=[
@@ -961,7 +944,7 @@ def create_quiz_interface():
961
  view_cert_btn
962
  ]
963
  )
964
-
965
  reset_btn.click(
966
  fn=reset_quiz,
967
  inputs=[text_input, num_questions],
@@ -980,17 +963,22 @@ def create_quiz_interface():
980
  )
981
 
982
  view_cert_btn.click(
983
- fn=view_certificate,
 
 
 
 
984
  outputs=tabs
985
  )
986
 
 
987
  # Certificate generation
988
  score_display.change(
989
  fn=quiz_app.certificate_generator.generate,
990
  inputs=[score_display, name, course_name, company_logo, participant_photo],
991
  outputs=certificate_display
992
  )
993
-
994
  return demo
995
 
996
  if __name__ == "__main__":
 
744
  """Navigate to Get Certified tab"""
745
  return gr.update(selected=2)
746
 
747
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  # Fix View Certificate navigation
749
  view_cert_btn.click(
750
  fn=goto_certificate,
 
879
  results_group,
880
  view_cert_btn
881
  ]
882
+ ).then( # Force navigation to assessment tab
883
+ fn=lambda: gr.Tabs(selected=1),
884
  outputs=tabs
885
  )
886
 
 
901
  question_box
902
  ]
903
  )
 
904
  next_btn.click(
905
  fn=handle_next,
906
  inputs=[
 
925
  outputs=answer_state
926
  )
927
 
928
+
929
  submit_btn.click(
930
  fn=on_submit,
931
  inputs=[
 
944
  view_cert_btn
945
  ]
946
  )
947
+
948
  reset_btn.click(
949
  fn=reset_quiz,
950
  inputs=[text_input, num_questions],
 
963
  )
964
 
965
  view_cert_btn.click(
966
+ fn=lambda: gr.Tabs(selected=2), # Directly navigate to certificate tab
967
+ outputs=tabs
968
+ )
969
+ back_to_assessment.click(
970
+ fn=lambda: gr.Tabs(selected=1), # Navigate back to assessment tab
971
  outputs=tabs
972
  )
973
 
974
+
975
  # Certificate generation
976
  score_display.change(
977
  fn=quiz_app.certificate_generator.generate,
978
  inputs=[score_display, name, course_name, company_logo, participant_photo],
979
  outputs=certificate_display
980
  )
981
+
982
  return demo
983
 
984
  if __name__ == "__main__":