Download app2.py from Avinash250325/Question_Generation_with_RAG: direct link, hf CLI and curl.
- Browser
- Download file 967 Bytes
-
https://huggingface.co/spaces/Avinash250325/Question_Generation_with_RAG/resolve/main/app2.py
- Command line
-
hf download hf://spaces/Avinash250325/Question_Generation_with_RAG/app2.py
-
curl -L -o app2.py https://huggingface.co/spaces/Avinash250325/Question_Generation_with_RAG/resolve/main/app2.py
967 Bytes
| 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() | |