{"id":27209226,"url":"https://github.com/intrepidkid/quiz-page","last_synced_at":"2026-04-21T05:33:34.136Z","repository":{"id":286980498,"uuid":"963165222","full_name":"intrepidkid/Quiz-Page","owner":"intrepidkid","description":"An interactive AI/ML quiz app that generates questions from PDFs using a T5 model and evaluates answers in real time using semantic similarity. Built with FastAPI, WebSockets, and ReactJS.","archived":false,"fork":false,"pushed_at":"2025-04-09T09:21:05.000Z","size":1391,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-06T22:08:58.284Z","etag":null,"topics":["ai","fastapi","prompt-engineering","python","reactjs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intrepidkid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-09T09:00:17.000Z","updated_at":"2025-04-09T09:24:44.000Z","dependencies_parsed_at":"2025-04-09T10:45:11.300Z","dependency_job_id":null,"html_url":"https://github.com/intrepidkid/Quiz-Page","commit_stats":null,"previous_names":["intrepidkid/quiz-page"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/intrepidkid/Quiz-Page","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intrepidkid%2FQuiz-Page","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intrepidkid%2FQuiz-Page/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intrepidkid%2FQuiz-Page/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intrepidkid%2FQuiz-Page/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intrepidkid","download_url":"https://codeload.github.com/intrepidkid/Quiz-Page/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intrepidkid%2FQuiz-Page/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021780,"owners_count":26087056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","fastapi","prompt-engineering","python","reactjs"],"created_at":"2025-04-10T00:39:55.251Z","updated_at":"2025-10-14T22:40:38.701Z","avatar_url":"https://github.com/intrepidkid.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 🧠 AI/ML Quiz Page\n\nAn interactive AI/ML Quiz application that uses a fine-tuned LLM to generate topic-based questions and evaluate user answers in real-time. Built with **ReactJS**, **FastAPI**, **WebSockets**, and **Hugging Face Transformers**.\n\n\u003e ⚠️ This is an early-stage project and will be expanded further to reach its full potential as an AI/ML quiz bot.\n\n---\n\n## 🚀 Features\n\n- Real-time quiz using WebSocket\n- Dynamic question generation from PDFs using T5 transformer\n- Semantic answer evaluation using Sentence Transformers\n- Frontend with topic/subtopic/difficulty selection\n- Immediate feedback and score (0–10) on answers\n- Fully asynchronous backend with FastAPI and Uvicorn\n- Unit testing included\n\n---\n\n## 🛠️ Tech Stack\n\n### 🔹 Frontend\n- ReactJS\n- HTML/CSS\n- WebSocket (Client-Side)\n\n### 🔹 Backend\n- **FastAPI**: API framework for async backend\n- **Uvicorn**: ASGI server for FastAPI\n- **WebSocket**: Real-time communication\n- **Transformers (Hugging Face)**: T5 model for question generation\n- **SentenceTransformers**: MiniLM for semantic similarity scoring\n- **PyMuPDF (fitz)**: Extract content from PDFs\n- **HTMLResponse**: For rendering HTML via FastAPI\n\n---\n\n## 🧠 Prompt Engineering Best Practices\n\nThe effectiveness of the AI/ML quiz system depends significantly on how prompts are designed and used with the models:\n\n- **Clarity and Specificity**: Prompts given to the T5 model for question generation are constructed clearly and concisely to produce relevant questions.\n- **Contextual Chunking**: Only the relevant section from the selected subtopic in the PDF is passed to the model, ensuring better focus and relevance.\n- **Few-shot Potential** *(to be added in future)*: Example-based prompting could improve question quality and variety as the system evolves.\n- **Semantic Scoring Feedback**: Evaluation feedback is based on semantic similarity, emphasizing not just keywords but meaning—critical for NLP tasks.\n- **Fallback Strategy** *(early-stage note)*: Simpler fallback (PDFs over external APIs) was used to ensure reliability and reduce latency.\n- **Dynamic Prompt Inputs**: The system is structured to accept dynamic topic/difficulty inputs and generate corresponding prompts/questions.\n\n---\n\n## 📦 Models Used\n\n### 1. **Question Generation**\n- **Model**: `valhalla/t5-small-qg-prepend`\n- **Purpose**: Generates questions based on topic PDFs\n\n### 2. **Answer Evaluation**\n- **Model**: `all-MiniLM-L6-v2` (Sentence-BERT)\n- **Purpose**: Computes semantic similarity between user input and expected answer\n\n---\n\n## ⚙️ How It Works\n\n1. **Topic Selection**:\n   - Choose between `AI` or `ML`.\n   - Each has 3 subtopics (from PDF).\n\n2. **Question Generation**:\n   - Content is extracted from a selected subtopic PDF.\n   - Passed to T5 to generate a question.\n\n3. **User Response**:\n   - User submits answer via WebSocket.\n   - Answer is evaluated using cosine similarity (via SentenceTransformer).\n\n4. **Feedback \u0026 Scoring**:\n   - Score (0–10) and dynamic feedback is returned to the frontend.\n\n---\n\n## 📂 Folder Structure (Expected)\n\n```\nAI_quiz/\n├── backend/\n│   ├── main.py\n│   ├── utils.py\n│   ├── models/\n│   ├── pdfs/\n│   └── test_main.py\n├── frontend/\n│   └── [React App Files]\n└── README.md\n```\n\n---\n\n## 🧪 Testing\n\n- ✅ Unit tests are available in `backend/test_main.py`\n- Run using `pytest` or any preferred test runner\n- All tests currently pass ✅ (green dot)\n\n---\n\n## 💡 Improvements Planned\n\n- Expand subtopics dynamically\n- Use external sources (e.g., Wikipedia API) with optimization\n- Fine-tune models for better performance\n- Add user authentication and progress tracking\n\n---\n\n## 🖥️ Local Development\n\n### 1. Start Backend\n```bash\nuvicorn main:app --reload\n```\n\n### 2. Start Frontend\n```bash\nnpm install\nnpm start\n```\n\n### 3. Access Application\nOpen [http://localhost:3000](http://localhost:3000)\n\n---\n\n## 🤝 Credits\n\nCreated by intrepidkid as a part of the AI/ML learning journey.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidkid%2Fquiz-page","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintrepidkid%2Fquiz-page","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintrepidkid%2Fquiz-page/lists"}