capradeepgujaran commited on
Commit
0be6fc8
·
verified ·
1 Parent(s): 6c517c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -23
app.py CHANGED
@@ -547,7 +547,7 @@ def create_quiz_interface():
547
 
548
  with gr.Tabs() as tabs:
549
  # Profile Setup Tab
550
- with gr.Tab("📋 Step 1: Profile Setup"):
551
  with gr.Row():
552
  name = gr.Textbox(label="Full Name", placeholder="Enter your full name")
553
  email = gr.Textbox(label="Email", placeholder="Enter your email")
@@ -573,7 +573,7 @@ def create_quiz_interface():
573
  generate_btn = gr.Button("Generate Assessment", variant="primary", size="lg")
574
 
575
  # Assessment Tab
576
- with gr.Tab("📝 Step 2: Take Assessment") as assessment_tab:
577
  with gr.Column(visible=True) as question_box:
578
  # Question section
579
  with gr.Group():
@@ -621,7 +621,7 @@ def create_quiz_interface():
621
  )
622
 
623
  # Certification Tab
624
- with gr.Tab(id=2,label="🎓 Step 3: Get Certified"):
625
  score_display = gr.Number(label="Your Score")
626
  result_message = gr.Markdown("")
627
  course_name = gr.Textbox(
@@ -634,7 +634,7 @@ def create_quiz_interface():
634
 
635
  def on_generate_questions(text: str, num_questions: int) -> List:
636
  success, questions = quiz_app.generate_questions(text, num_questions)
637
- tab_index = 1 # Index for "Take Assessment" tab
638
 
639
  if not success:
640
  return [
@@ -645,7 +645,7 @@ def create_quiz_interface():
645
  [],
646
  0,
647
  [None] * 5,
648
- gr.Tabs(selected=tab_index),
649
  gr.update(visible=False),
650
  gr.update(visible=False)
651
  ]
@@ -671,22 +671,8 @@ def create_quiz_interface():
671
  gr.update(visible=False)
672
  ]
673
 
674
-
675
- def goto_take_assessment():
676
- """Navigate to Take Assessment tab"""
677
- return gr.Tabs(selected=1)
678
-
679
- def goto_certificate():
680
- """Navigate to Get Certified tab"""
681
- return gr.Tabs(selected=2)
682
-
683
 
684
- # Fix View Certificate navigation
685
- view_cert_btn.click(
686
- fn=goto_certificate,
687
- outputs=tabs
688
- )
689
-
690
  # Add "Back to Assessment" button in results view
691
  back_to_assessment = gr.Button("Back to Assessment", visible=False)
692
  back_to_assessment.click(
@@ -796,9 +782,9 @@ def create_quiz_interface():
796
 
797
  def view_certificate():
798
  """Navigate to certificate tab"""
799
- return gr.Tabs(selected=2)
800
 
801
- def change_to_tab_two():
802
  return gr.Tabs(selected=2) #This will navigate
803
 
804
  # Event handlers
@@ -907,7 +893,7 @@ def create_quiz_interface():
907
 
908
 
909
  back_to_assessment.click(
910
- fn=change_to_tab_two,inputs=None,
911
  outputs=[tabs]
912
  )
913
 
 
547
 
548
  with gr.Tabs() as tabs:
549
  # Profile Setup Tab
550
+ with gr.Tab(id=1,label="📋 Step 1: Profile Setup"):
551
  with gr.Row():
552
  name = gr.Textbox(label="Full Name", placeholder="Enter your full name")
553
  email = gr.Textbox(label="Email", placeholder="Enter your email")
 
573
  generate_btn = gr.Button("Generate Assessment", variant="primary", size="lg")
574
 
575
  # Assessment Tab
576
+ with gr.Tab(id=2,label="📝 Step 2: Take Assessment") as assessment_tab:
577
  with gr.Column(visible=True) as question_box:
578
  # Question section
579
  with gr.Group():
 
621
  )
622
 
623
  # Certification Tab
624
+ with gr.Tab(id=3,label="🎓 Step 3: Get Certified"):
625
  score_display = gr.Number(label="Your Score")
626
  result_message = gr.Markdown("")
627
  course_name = gr.Textbox(
 
634
 
635
  def on_generate_questions(text: str, num_questions: int) -> List:
636
  success, questions = quiz_app.generate_questions(text, num_questions)
637
+ tab_index = 2 # Index for "Take Assessment" tab
638
 
639
  if not success:
640
  return [
 
645
  [],
646
  0,
647
  [None] * 5,
648
+ gr.Tabs(selected=2),
649
  gr.update(visible=False),
650
  gr.update(visible=False)
651
  ]
 
671
  gr.update(visible=False)
672
  ]
673
 
 
 
 
 
 
 
 
 
 
674
 
675
+
 
 
 
 
 
676
  # Add "Back to Assessment" button in results view
677
  back_to_assessment = gr.Button("Back to Assessment", visible=False)
678
  back_to_assessment.click(
 
782
 
783
  def view_certificate():
784
  """Navigate to certificate tab"""
785
+ return gr.Tabs(selected=3)
786
 
787
+ def back_to_assessment():
788
  return gr.Tabs(selected=2) #This will navigate
789
 
790
  # Event handlers
 
893
 
894
 
895
  back_to_assessment.click(
896
+ fn=back_to_assessment,
897
  outputs=[tabs]
898
  )
899