Transform any Wikipedia article into an interactive, educational quiz using AI! This full-stack application uses Google's Gemini AI to automatically generate engaging quizzes from Wikipedia content.
- ๐ URL Input: Simply paste any Wikipedia article URL
- ๐ค AI-Powered: Uses Google Gemini to generate intelligent quiz questions
- ๐ Smart Quizzes: Creates 5-10 multiple choice questions with explanations
- ๐พ History Tracking: Saves all generated quizzes in a database
- ๐ฏ Interactive UI: Take quizzes with instant feedback and scoring
- ๐ Answer Explanations: Learn why answers are correct or incorrect
- Python 3.10+ - Core programming language
- FastAPI - Modern web framework for APIs
- SQLAlchemy - Database ORM
- LangChain - Framework for LLM applications
- Google Gemini - AI model for quiz generation
- BeautifulSoup4 - Web scraping library
- SQLite - Database for storing quizzes
- React - UI library
- Tailwind CSS - Styling framework
- Vite - Build tool
- Python 3.10 or higher
- Node.js 16+ and npm
- Google Gemini API key (Get it here)
1. Clone the repository
git clone https://github.com/Srishanth57/QuizGeneratorAssignment.git
cd ai-wiki-quiz-generator2. Setup Backend
cd backend
# Create virtual environment
python -m venv venv
# Activate it
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
echo "GEMINI_API_KEY=your_api_key_here" > .env3. Setup Frontend
cd ../frontend
# Install dependencies
npm installStart Backend (Terminal 1)
cd backend
python main.pyBackend runs at http://localhost:8000
Start Frontend (Terminal 2)
cd frontend
npm run devFrontend runs at http://localhost:5173
Open your browser and visit http://localhost:5173 ๐
-
Generate a Quiz
- Click on "Generate Quiz" tab
- Paste a Wikipedia URL (e.g.,
https://en.wikipedia.org/wiki/Artificial_intelligence) - Click "Generate Quiz"
- Wait 10-30 seconds for AI to create your quiz
-
Take the Quiz
- Select answers for each question
- Click "Submit Quiz" when done
- See your score and read explanations
-
View History
- Click "Quiz History" tab
- See all your generated quizzes
- Click "View Details" to retake any quiz
ai-quiz-generator/
โโโ backend/
โ โโโ database.py # Database setup
โ โโโ models.py # Data models
โ โโโ scraper.py # Wikipedia scraper
โ โโโ llm_quiz_generator.py # AI quiz generation
โ โโโ main.py # FastAPI app
โ โโโ requirements.txt # Python dependencies
โ โโโ .env # API keys (create this)
โ
โโโ frontend/
โโโ src/
โ โโโ components/
โ โ โโโ QuizDisplay.jsx # Quiz UI component
โ โโโ services/
โ โ โโโ api.js # API calls
โ โโโ tabs/
โ โ โโโ GenerateQuizTab.jsx
โ โ โโโ HistoryTab.jsx
โ โโโ App.jsx # Main app
โ โโโ index.css # Styles
โโโ package.json
| Method | Endpoint | Description |
|---|---|---|
| POST | /generate_quiz |
Generate quiz from Wikipedia URL |
| GET | /history |
Get all generated quizzes |
| GET | /quiz/{id} |
Get specific quiz by ID |
curl -X POST http://localhost:8000/generate_quiz \
-H "Content-Type: application/json" \
-d '{"url": "https://en.wikipedia.org/wiki/Python_(programming_language)"}'Test the Backend API
# Visit the interactive API docs
http://localhost:8000/docsTest with Sample URLs
- Python:
https://en.wikipedia.org/wiki/Python_(programming_language) - AI:
https://en.wikipedia.org/wiki/Artificial_intelligence - Space:
https://en.wikipedia.org/wiki/Solar_System
"GEMINI_API_KEY not found"
- Make sure you created
.envfile inbackendfolder - Check your API key is correct
"Module not found"
- Activate virtual environment:
source venv/bin/activate - Install dependencies:
pip install -r requirements.txt
"Failed to fetch"
- Make sure backend is running on port 8000
- Check if both frontend and backend are running
Styles not loading
- Run
npm installagain - Clear browser cache
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- FastAPI - Amazing Python web framework
- LangChain - LLM application framework
- Google Gemini - Powerful AI model
- Wikipedia - Source of knowledge
Your Name - @yourtwitter
Project Link: https://github.com/yourusername/ai-wiki-quiz-generator
โญ If you found this project helpful, please give it a star!
- User authentication and profiles
- Difficulty level selection
- Export quiz to PDF
- Share quizzes with friends
- Quiz analytics and statistics
- Support for multiple languages
- Mobile app version
- Timed quiz mode
- Leaderboard system

