Spaces:
Runtime error
Runtime error
| 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() | |