File size: 1,151 Bytes
c924c3e
 
 
 
 
0c7f816
 
 
 
 
 
 
c924c3e
 
 
 
 
 
 
 
 
 
0c7f816
c924c3e
 
 
 
 
 
 
 
 
 
 
0c7f816
c924c3e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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)