Spaces:
Sleeping
Sleeping
updated flow v.02
Browse files- app.py +9 -1
- gradio_app.py +0 -36
app.py
CHANGED
|
@@ -3,6 +3,13 @@ from main import flow
|
|
| 3 |
|
| 4 |
|
| 5 |
with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
with gr.Row():
|
| 7 |
with gr.Column():
|
| 8 |
student_pdf_path = gr.File(label="Student's PDF Response")
|
|
@@ -13,7 +20,7 @@ with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo:
|
|
| 13 |
submit_btn = gr.Button("Evaluate Exam")
|
| 14 |
|
| 15 |
with gr.Row():
|
| 16 |
-
output = gr.File(label="Output PDF
|
| 17 |
|
| 18 |
|
| 19 |
def evaluate_exam(student_pdf_path, standard_pdf_path):
|
|
@@ -25,4 +32,5 @@ with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo:
|
|
| 25 |
|
| 26 |
return flow(student_pdf_path, standard_pdf_path, save_dict, student_dict_path, standard_dict_path, output_pdf_path)
|
| 27 |
|
|
|
|
| 28 |
demo.launch(share=True, pwa=True, debug=True)
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo:
|
| 6 |
+
|
| 7 |
+
gr.HTML(
|
| 8 |
+
"""
|
| 9 |
+
<h1 style="font-size: 3.5em; text-align: center; color: #02c160; font-weight: bold;">AI Exam Checker</h1>
|
| 10 |
+
"""
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
with gr.Row():
|
| 14 |
with gr.Column():
|
| 15 |
student_pdf_path = gr.File(label="Student's PDF Response")
|
|
|
|
| 20 |
submit_btn = gr.Button("Evaluate Exam")
|
| 21 |
|
| 22 |
with gr.Row():
|
| 23 |
+
output = gr.File(label="Output PDF", interactive=False)
|
| 24 |
|
| 25 |
|
| 26 |
def evaluate_exam(student_pdf_path, standard_pdf_path):
|
|
|
|
| 32 |
|
| 33 |
return flow(student_pdf_path, standard_pdf_path, save_dict, student_dict_path, standard_dict_path, output_pdf_path)
|
| 34 |
|
| 35 |
+
submit_btn.click(evaluate_exam, inputs=[student_pdf_path, standard_pdf_path], outputs=output)
|
| 36 |
demo.launch(share=True, pwa=True, debug=True)
|
gradio_app.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from main import flow
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo:
|
| 6 |
-
|
| 7 |
-
gr.HTML(
|
| 8 |
-
"""
|
| 9 |
-
<h1 style="font-size: 3.5em; text-align: center; color: #02c160; font-weight: bold;">AI Exam Checker</h1>
|
| 10 |
-
"""
|
| 11 |
-
)
|
| 12 |
-
|
| 13 |
-
with gr.Row():
|
| 14 |
-
with gr.Column():
|
| 15 |
-
student_pdf_path = gr.File(label="Student's PDF Response")
|
| 16 |
-
with gr.Column():
|
| 17 |
-
standard_pdf_path = gr.File(label="Standard Answer Key PDF")
|
| 18 |
-
|
| 19 |
-
with gr.Row():
|
| 20 |
-
submit_btn = gr.Button("Evaluate Exam")
|
| 21 |
-
|
| 22 |
-
with gr.Row():
|
| 23 |
-
output = gr.File(label="Output PDF", interactive=False)
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
def evaluate_exam(student_pdf_path, standard_pdf_path):
|
| 27 |
-
|
| 28 |
-
save_dict = True
|
| 29 |
-
student_dict_path = "student_response.json"
|
| 30 |
-
standard_dict_path = "standard_key.json"
|
| 31 |
-
output_pdf_path = "output_report.pdf"
|
| 32 |
-
|
| 33 |
-
return flow(student_pdf_path, standard_pdf_path, save_dict, student_dict_path, standard_dict_path, output_pdf_path)
|
| 34 |
-
|
| 35 |
-
submit_btn.click(evaluate_exam, inputs=[student_pdf_path, standard_pdf_path], outputs=output)
|
| 36 |
-
demo.launch(share=True, pwa=True, debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|