File size: 967 Bytes
99df86b
 
 
 
8270b46
99df86b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from backend import process_pdf

with gr.Blocks() as demo:
    gr.Markdown("## AI-Powered Question Generator from Textbook PDFs")

    with gr.Row():
        pdf_input = gr.File(label="Upload Textbook PDF", file_types=[".pdf"])
        tag_input = gr.Dropdown(
            label="Question Type",
            choices=["short answer", "long answer", "true or false", "multiple choice question"],
            value="short answer"
        )
        difficulty_input = gr.Dropdown(
            label="Difficulty",
            choices=["easy", "medium", "hard"],
            value="medium"
        )
        query_input = gr.Textbox(label="Enter your query")

    generate_button = gr.Button("Generate Questions")
    output_text = gr.Textbox(label="Generated Questions", lines=10)

    generate_button.click(
        fn=process_pdf,
        inputs=[pdf_input, tag_input, difficulty_input, query_input],
        outputs=output_text
    )

demo.launch()