Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -815,39 +815,39 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
|
|
| 815 |
)
|
| 816 |
|
| 817 |
with gr.Tabs():
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
|
| 836 |
-
|
| 837 |
-
|
| 838 |
-
|
| 839 |
-
|
| 840 |
-
|
| 841 |
-
|
| 842 |
-
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
### 📝 Type Your Answers
|
| 852 |
|
| 853 |
**Instructions:** Type each answer in the box below. Use one of these formats:
|
|
@@ -874,24 +874,24 @@ with gr.Blocks(title="UNEB Exam Prep - Primary 6 & 7", theme=gr.themes.Soft(), c
|
|
| 874 |
Q2: Your answer here
|
| 875 |
Q3: Your answer here
|
| 876 |
```
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
|
| 896 |
# Improved submission handler with better parsing
|
| 897 |
def submit_answers(canvas_input, upload_input, typed_input):
|
|
|
|
| 815 |
)
|
| 816 |
|
| 817 |
with gr.Tabs():
|
| 818 |
+
# Method 1: Draw
|
| 819 |
+
with gr.Tab("✏️ Draw Answers"):
|
| 820 |
+
canvas = gr.Sketchpad(
|
| 821 |
+
label="Draw or write your answers here",
|
| 822 |
+
type="pil",
|
| 823 |
+
height=500,
|
| 824 |
+
brush=gr.Brush(
|
| 825 |
+
colors=["#000000", "#0000FF", "#FF0000"],
|
| 826 |
+
default_size=4
|
| 827 |
+
)
|
| 828 |
+
)
|
| 829 |
+
canvas_status = gr.Textbox(
|
| 830 |
+
label="Canvas Status",
|
| 831 |
+
interactive=False,
|
| 832 |
+
value="Ready to draw"
|
| 833 |
+
)
|
| 834 |
+
|
| 835 |
+
# Method 2: Upload
|
| 836 |
+
with gr.Tab("📸 Upload Photo"):
|
| 837 |
+
upload_image = gr.Image(
|
| 838 |
+
label="Upload photo of your written work",
|
| 839 |
+
type="pil",
|
| 840 |
+
height=500
|
| 841 |
+
)
|
| 842 |
+
upload_status = gr.Textbox(
|
| 843 |
+
label="Upload Status",
|
| 844 |
+
interactive=False,
|
| 845 |
+
value="Ready to upload"
|
| 846 |
+
)
|
| 847 |
+
|
| 848 |
+
# Method 3: Type
|
| 849 |
+
with gr.Tab(" Type Answers"):
|
| 850 |
+
gr.Markdown("""
|
| 851 |
### 📝 Type Your Answers
|
| 852 |
|
| 853 |
**Instructions:** Type each answer in the box below. Use one of these formats:
|
|
|
|
| 874 |
Q2: Your answer here
|
| 875 |
Q3: Your answer here
|
| 876 |
```
|
| 877 |
+
""")
|
| 878 |
+
|
| 879 |
+
typed_answers = gr.Textbox(
|
| 880 |
+
label="Type Your Answers Here",
|
| 881 |
+
lines=20,
|
| 882 |
+
placeholder="Type your answers using any of the formats shown above...",
|
| 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
|
| 894 |
+
)
|
| 895 |
|
| 896 |
# Improved submission handler with better parsing
|
| 897 |
def submit_answers(canvas_input, upload_input, typed_input):
|