How siddharthakosti/genai-doc2qa works
Project type and purpose
• This is a single-page Streamlit application (“GenAI-Doc2QA”) whose primary purpose is to let users upload a PDF, specify how many question/answer pairs they want, and then generate those pairs by calling OpenAI’s GPT-4 model.
File structure
• Top-level files:
• app.py: the Streamlit entrypoint (UI + orchestration)
• template.py: any custom rendering or UI helpers
• setup.py + requirements.txt: packaging and dependencies
• data/: static assets (e.g., screenshots, sample files)
• research/: Jupyter notebook for offline model/ prompt experiments
• src/ directory:
• src/helper.py: handles PDF ingestion and text extraction
• src/prompt.py: builds/ formats the prompts sent to OpenAI
• No separate “backend” folder—Streamlit acts as both front-end and lightweight server.
README for additional insights
• Confirms the Streamlit UI flow: upload PDF → choose count → click “Generate” → calls OpenAI API → displays Q/A pairs.
• Environment variable OPENAI_API_KEY is required.
• No database or persistent storage—file I/O is ephemeral in-memory.
Detail without overcomplicating
• Environment variable store (.env / OPENAI_API_KEY) as a configuration artifact
• Retry logic, error handling, or logging that occurs around the API call