Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from main import flow | |
| with gr.Blocks(theme= "JohnSmith9982/small_and_pretty") as demo: | |
| gr.HTML( | |
| """ | |
| <h1 style="font-size: 3.5em; text-align: center; color: #02c160; font-weight: bold;">AI Exam Checker</h1> | |
| """ | |
| ) | |
| with gr.Row(): | |
| with gr.Column(): | |
| student_pdf_path = gr.File(label="Student's PDF Response") | |
| with gr.Column(): | |
| standard_pdf_path = gr.File(label="Standard Answer Key PDF") | |
| with gr.Row(): | |
| submit_btn = gr.Button("Evaluate Exam") | |
| with gr.Row(): | |
| output = gr.File(label="Output PDF", interactive=False) | |
| def evaluate_exam(student_pdf_path, standard_pdf_path): | |
| save_dict = True | |
| student_dict_path = "student_response.json" | |
| standard_dict_path = "standard_key.json" | |
| output_pdf_path = "output_report.pdf" | |
| return flow(student_pdf_path, standard_pdf_path, save_dict, student_dict_path, standard_dict_path, output_pdf_path) | |
| submit_btn.click(evaluate_exam, inputs=[student_pdf_path, standard_pdf_path], outputs=output) | |
| demo.launch(share=True, pwa=True, debug=True) |