An intelligent web application that automatically generates Multiple Choice Questions (MCQs) from PDF documents using AI. Built for the PISB Hackathon, this tool helps educators and students create practice tests from their study materials.
- PDF Text Extraction: Automatically extracts text content from uploaded PDF files
- Topic Detection: AI-powered topic extraction from document content
- Smart MCQ Generation: Generates contextually relevant questions using AI models
- Customizable Difficulty: Choose from Easy, Medium, and Hard difficulty levels
- Flexible Question Count: Generate 5-50 questions per session
- Timer Support: Optional timed test sessions
- Interactive Test Interface: Clean, modern UI for taking generated tests
- Instant Results: Immediate scoring and detailed explanations
- No Cloud services used: This project runs locally
This project consists of two main components:
- FastAPI server for RESTful API endpoints
- PDF Processing using PyMuPDF for text extraction
- AI Models using Ollama (phi3 and llama3.1) for topic extraction and MCQ generation
- RAG: FAISS vector store built from OCR text to ground MCQ generation
- React 18 with TypeScript for type safety
- Vite for fast development and building
- Tailwind CSS for styling
- Shadcn/ui components for modern UI
- React Router for navigation
- React Query for API state management
Note: Translation has been removed. The app now goes directly from Timer β Starting β Test after question generation.
Before running this project, ensure you have the following installed:
- Node.js (v18 or higher)
- Python (v3.8 or higher)
- Ollama (for local AI models)
- Git (for cloning the repository)
git clone https://github.com/Niranjan-cyber/Hackathors.git
cd Hackathors# Install the required AI models
ollama pull llama3.1Use the provided script to start both backend and frontend simultaneously:
chmod +x run_all.sh
./run_all.shThis will:
- Start the FastAPI backend on
http://localhost:8000 - Start the React frontend on
http://localhost:5173 - Launch the required Ollama AI models
cd backend
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Start the server
chmod +x start.sh
./start.shcd frontend
# Install dependencies
npm install
# Start development server
chmod +x start.sh
./start.sh- Navigate to the application in your browser
- Click "Choose File" to upload a PDF document
- Supported formats: PDF files with text content
- The system will automatically scan your document and extract topics
- Select the topics you want questions generated for
- You can select multiple topics or all detected topics
- Difficulty Level: Choose Easy, Medium, or Hard
- Question Count: Select between 1-50 questions
- Timer: Optionally set a time limit for the test
- Review each question and select your answer
- Navigate between questions using the interface
- Submit when finished or when time runs out
- See your score and performance
- Review correct answers and explanations
- Option to restart with new settings
POST /extract-topics/
Content-Type: multipart/form-data
Parameters:
- file: PDF file upload
POST /generate-questions/
Content-Type: multipart/form-data
Parameters:
- topics: JSON string or comma-separated list
- difficulty: "easy", "medium", or "hard"
- num_questions: integer (1-50)
-
Home
-
Topic Selection
-
Difficulty Selection
-
Number of Questions
-
Timer Selection
-
Question Interface
-
Results
Hackathors/
βββ docs/
β βββ screenshots/ # README images
βββ backend/
β βββ app/
β β βββ main.py # FastAPI application
β β βββ models/ # AI models and processing
β β βββ routes/ # API endpoints
β β βββ schemas/ # Data models
β βββ requirements.txt # Python dependencies
β βββ start.sh # Backend startup script
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Page components
β β βββ App.tsx # Main app component
β βββ package.json # Node.js dependencies
β βββ start.sh # Frontend startup script
βββ testing_data/ # Sample PDF files
βββ run_all.sh # Combined startup script
βββ README.md # This file








