An advanced AI-powered examination tool designed for university students to test their knowledge through interactive Q&A sessions with voice integration. The system uses OpenAI's GPT-4 for question generation and Whisper for speech-to-text capabilities, creating a comprehensive oral and written examination experience.
- π Material Upload: Support for PDF, DOCX, and TXT files
- π€ AI Question Generation: Automatic question creation using OpenAI GPT-4
- π Interactive Exams: Dynamic question-answer sessions
- π£οΈ Voice Integration: Oral exam simulation with OpenAI Whisper
- π Comprehensive Scoring: Advanced scoring algorithm (0-10 scale)
- π¬ Follow-up Questions: AI-generated deeper inquiry questions
- π Performance Analytics: Detailed score reports and recommendations
- π― Adaptive Difficulty: Questions adapted to student performance
- β±οΈ Time Tracking: Response time analysis
- π Text-to-Speech: AI-generated audio feedback
- π± Real-time Chat: Interactive conversation interface
- π Question Export: Save generated questions to text files
- π¨ Modern UI: Beautiful, responsive interface with Tailwind CSS
- FastAPI - High-performance web framework
- SQLAlchemy - Database ORM with SQLite/PostgreSQL support
- OpenAI API - GPT-4 for question generation, Whisper for voice
- Pydantic - Data validation and serialization
- Uvicorn - ASGI server for production deployment
- React 18 - Modern React with hooks and context
- TypeScript - Type-safe development
- Vite - Fast build tool and development server
- Tailwind CSS - Utility-first CSS framework
- React Router - Client-side routing
- Axios - HTTP client for API communication
- Python 3.9+
- Node.js 18+
- npm 9+
- OpenAI API Key
git clone https://github.com/your-username/ai-examiner.git
cd ai-examiner
cd backend
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Edit .env file with your settings
OPENAI_API_KEY=your_openai_api_key_here
DATABASE_URL=sqlite:///./ai_examiner.db
DEBUG=True
python -c "from database import init_database; init_database()"
# Development mode
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Production mode
uvicorn main:app --host 0.0.0.0 --port 8000
cd frontend
npm install
# Development mode with hot reload
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
- Navigate to the upload section
- Select a PDF, DOCX, or TXT file containing study material
- Provide a title, description, and subject
- Click "Upload and Process"
- Select your uploaded material
- Choose number of questions (1-50)
- Select question types:
- Multiple Choice
- Short Answer
- Essay
- True/False
- Set difficulty level (1-5)
- Click "Generate Questions"
- Start a new exam session
- Answer questions using text or voice input
- Get real-time feedback and explanations
- Receive follow-up questions for deeper understanding
- Recording: Click the microphone to record voice answers
- Transcription: Automatic speech-to-text conversion
- Feedback: AI-generated audio responses
- Oral Exam Mode: Full voice-based examination experience
- View comprehensive score report (0-10 scale)
- Analyze performance by difficulty level
- Read AI-generated strengths and weaknesses
- Get personalized study recommendations
POST /api/upload/material # Upload study material
GET /api/upload/materials # List all materials
GET /api/upload/material/{id} # Get specific material
DELETE /api/upload/material/{id} # Delete material
POST /api/questions/generate # Generate questions from material
GET /api/questions/material/{id} # Get questions for material
GET /api/questions/{id} # Get specific question
DELETE /api/questions/{id} # Delete question
POST /api/exam/start # Start new exam session
GET /api/exam/session/{id} # Get session status
POST /api/exam/session/{id}/answer # Submit answer
POST /api/exam/session/{id}/followup # Generate follow-up question
GET /api/exam/session/{id}/progress # Get detailed progress
POST /api/voice/transcribe # Transcribe audio to text
POST /api/voice/synthesize # Convert text to speech
POST /api/voice/record-session # Record voice session
POST /api/scoring/session/{id}/calculate # Calculate comprehensive score
GET /api/scoring/session/{id}/report # Get detailed score report
GET /api/scoring/sessions/history # Get exam history
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Database
DATABASE_URL=sqlite:///./ai_examiner.db
# Application
DEBUG=False
SECRET_KEY=your_secret_key_here
# File Upload
MAX_FILE_SIZE=10485760 # 10MB
UPLOAD_DIRECTORY=uploads
# Security
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173
# Redis (for caching)
REDIS_URL=redis://localhost:6379
# Voice Processing
AUDIO_DIRECTORY=audio
MAX_AUDIO_DURATION=300 # 5 minutes
cd backend
pytest -v # Run all tests
pytest tests/test_upload.py # Test specific module
pytest --cov=. # Run with coverage
cd frontend
npm test # Run unit tests
npm run test:coverage # Run with coverage
npm run test:e2e # Run end-to-end tests
ai-examiner/
βββ backend/
β βββ main.py # FastAPI application
β βββ models.py # Data models
β βββ database.py # Database configuration
β βββ routers/ # API route handlers
β β βββ upload.py # File upload endpoints
β β βββ questions.py # Question generation
β β βββ exam.py # Exam session management
β β βββ scoring.py # Scoring and analytics
β β βββ voice.py # Voice processing
β βββ uploads/ # Uploaded files
β βββ questions/ # Generated question files
β βββ audio/ # Voice recordings
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ contexts/ # React contexts
β β βββ hooks/ # Custom hooks
β β βββ pages/ # Page components
β β βββ services/ # API services
β β βββ types/ # TypeScript types
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ dist/ # Built files
βββ README.md # This file
- Create new endpoint in appropriate router
- Add request/response models in
models.py
- Update database schema if needed
- Add comprehensive docstrings and error handling
- Create TypeScript types in
src/types/
- Add API service functions in
src/services/
- Create React components with proper props typing
- Add routing if necessary
- Create account at OpenAI
- Generate API key in dashboard
- Set up billing and usage limits
- Add key to
.env
file
- SQLite: Default, no additional setup required
- PostgreSQL: Update
DATABASE_URL
with connection string - MySQL: Install
pymysql
and update connection string
# Install production dependencies
pip install gunicorn
# Run with Gunicorn
gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
# Build for production
npm run build
# Serve with your preferred web server
# Example with nginx or serve
npx serve -s dist -l 3000
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Make your changes with proper tests and documentation
- Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow PEP 8 for Python code
- Use ESLint/Prettier for TypeScript/React code
- Write comprehensive docstrings and comments
- Add tests for new functionality
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI for GPT-4 and Whisper APIs
- FastAPI for the excellent web framework
- React Team for the powerful frontend library
- Tailwind CSS for the utility-first CSS framework
For questions, issues, or contributions:
- Open an issue on GitHub
- Check the API Documentation
- Review the comprehensive docstrings in the code
Built with β€οΈ for university students worldwide