mikaelJ46 commited on
Commit
ea28ecd
·
verified ·
1 Parent(s): 4aaafc4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -20
app.py CHANGED
@@ -688,11 +688,6 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
688
 
689
  # Global state for questions
690
  questions_state = gr.State(value=[])
691
- # Shared question display (visible across tabs so students don't switch panels)
692
- questions_display = gr.HTML(
693
- value="",
694
- elem_classes="question-display"
695
- )
696
 
697
  # Student name input
698
  with gr.Group():
@@ -707,7 +702,9 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
707
  return f"Welcome, {session.student_name}!"
708
 
709
  student_name_input.change(update_student_name, student_name_input, None)
710
-
 
 
711
  with gr.Tabs():
712
  # ===== TAB 1: GENERATE QUESTIONS =====
713
  with gr.Tab("1️⃣ Generate Questions"):
@@ -805,16 +802,23 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
805
  with gr.Tab("2️⃣ Answer Questions"):
806
  gr.Markdown("### Step 2: Answer the Questions")
807
  gr.Markdown("Write out your working and answers. You can use any of the three methods below.")
808
-
 
809
  with gr.Row():
810
- method_info = gr.Textbox(
811
- label="How to Submit Answers",
812
- value="Method 1: Draw/Write in canvas\nMethod 2: Upload photo of your written work\nMethod 3: Type your answers directly",
813
- interactive=False,
814
- lines=3
815
- )
816
-
817
- with gr.Tabs():
 
 
 
 
 
 
818
  # Method 1: Draw
819
  with gr.Tab("✏️ Draw Answers"):
820
  canvas = gr.Sketchpad(
@@ -883,11 +887,11 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
883
  elem_classes="answer-input"
884
  )
885
 
886
- # Combined submit button
887
- with gr.Row():
888
- submit_btn = gr.Button(" Submit for Correction", variant="primary", size="lg")
889
-
890
- submit_status = gr.Textbox(
891
  label="Submission Status",
892
  interactive=False,
893
  lines=2
 
688
 
689
  # Global state for questions
690
  questions_state = gr.State(value=[])
 
 
 
 
 
691
 
692
  # Student name input
693
  with gr.Group():
 
702
  return f"Welcome, {session.student_name}!"
703
 
704
  student_name_input.change(update_student_name, student_name_input, None)
705
+ # Shared question display (placed below name and above the tabs to avoid large empty header)
706
+ questions_display = gr.HTML(value="", elem_classes="question-display")
707
+
708
  with gr.Tabs():
709
  # ===== TAB 1: GENERATE QUESTIONS =====
710
  with gr.Tab("1️⃣ Generate Questions"):
 
802
  with gr.Tab("2️⃣ Answer Questions"):
803
  gr.Markdown("### Step 2: Answer the Questions")
804
  gr.Markdown("Write out your working and answers. You can use any of the three methods below.")
805
+
806
+ # Two-column layout: left = questions, right = answer methods
807
  with gr.Row():
808
+ with gr.Column(scale=6):
809
+ gr.Markdown("**Questions (keep visible while answering)**")
810
+ # show the same shared questions_display here
811
+ q_left = questions_display
812
+ with gr.Column(scale=6):
813
+ with gr.Row():
814
+ method_info = gr.Textbox(
815
+ label="How to Submit Answers",
816
+ value="Method 1: Draw/Write in canvas\nMethod 2: Upload photo of your written work\nMethod 3: Type your answers directly",
817
+ interactive=False,
818
+ lines=3
819
+ )
820
+
821
+ with gr.Tabs():
822
  # Method 1: Draw
823
  with gr.Tab("✏️ Draw Answers"):
824
  canvas = gr.Sketchpad(
 
887
  elem_classes="answer-input"
888
  )
889
 
890
+ # Combined submit button
891
+ with gr.Row():
892
+ submit_btn = gr.Button(" Submit for Correction", variant="primary", size="lg")
893
+
894
+ submit_status = gr.Textbox(
895
  label="Submission Status",
896
  interactive=False,
897
  lines=2