https://github.com/cltxvz/snapquiz
Test your memory with AI-generated quizzes based on random images!
https://github.com/cltxvz/snapquiz
ai bootstrap computer-vision flask full-stack google-gemini-ai heroku image-processing javascript memory-game nodejs python react rest-api web-scraping
Last synced: 3 months ago
JSON representation
Test your memory with AI-generated quizzes based on random images!
- Host: GitHub
- URL: https://github.com/cltxvz/snapquiz
- Owner: cltxvz
- Created: 2025-02-18T17:53:18.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-28T18:09:31.000Z (over 1 year ago)
- Last Synced: 2025-02-28T22:26:22.290Z (over 1 year ago)
- Topics: ai, bootstrap, computer-vision, flask, full-stack, google-gemini-ai, heroku, image-processing, javascript, memory-game, nodejs, python, react, rest-api, web-scraping
- Language: JavaScript
- Homepage: https://snapquiz-frontend-489546fcd686.herokuapp.com
- Size: 225 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# **πΈ SnapQuiz**
*"Test your memory with AI-generated quizzes based on random images!"*
---
## **π Description**
**SnapQuiz** is an interactive web application that challenges players to **memorize an image for a few seconds** and then answer **AI-generated multiple-choice questions** about it. This project leverages **Google Gemini AI Vision** to analyze images and create dynamic quizzes.
### **How It Works:**
1. **The app finds a random image online** (Wikimedia Commons).
2. **You have a few seconds to memorize it.**
3. **Answer multiple-choice questions** about the image.
4. **Get your score and see the correct answers!**
SnapQuiz is a fun and engaging way to test **visual memory, observation skills, and attention to detail!**
---
## **π οΈ Technologies Used**
### **Frontend (React & UI)**
- **React.js** β Component-based UI development.
- **React Router** β Navigation between pages.
- **Bootstrap 5** β Responsive UI and styling.
- **Axios** β API calls to the backend.
- **React Hooks** β (`useState`, `useEffect`) for state management.
### **Backend (Flask & AI Integration)**
- **Flask** β Lightweight Python backend.
- **Google Gemini AI Vision** β Image analysis & quiz generation.
- **BeautifulSoup** β Web scraping to find random images.
- **Pillow (PIL)** β Image processing and conversion.
- **Requests** β Fetching images from Wikimedia Commons.
### **Deployment & Hosting**
- **Heroku (Frontend + Backend)** β Hosting the full application.
- **Git & GitHub** β Version control and collaboration.
---
## **π Skills & Concepts Applied**
### **Full-Stack Development**
- **Frontend + Backend Integration** β Connecting React with Flask.
- **RESTful API Development** β Handling GET/POST requests for images & quizzes.
- **AI Integration** β Using **Google Gemini AI Vision** for custom quiz generation.
### **Software Engineering Best Practices**
- **Modular Code Structure** β Well-organized frontend & backend.
- **Error Handling & Debugging** β Handling invalid images, API failures, and retries.
- **Optimized API Calls** β Efficient **image fetching & quiz generation**.
- **Environment Variables (`.env`)** β Securing API keys & backend credentials.
### **AI & Data Processing**
- **Image Scraping & Filtering** β Using **BeautifulSoup** to select **valid images**.
- **Image Processing** β Resizing and converting images for AI compatibility.
- **AI Prompt Engineering** β Crafting effective prompts for **accurate quiz generation**.
### **UI/UX & Performance Optimization**
- **Responsive Design** β Mobile-friendly interface with **Bootstrap 5**.
- **Timers & Animations** β Countdown timers for memorization phase.
- **Loading States & Status Updates** β Improved user experience with dynamic loading messages.
---
## **π Features & How to Play**
### **Game Flow:**
1. **Click "Start Game"** β The app finds a random image.
2. **Memorize the image** β You have **15 seconds** before it disappears!
3. **Answer the quiz** β AI-generated multiple-choice questions test your memory.
4. **See your final score** β Review answers and improve!
### **Game Modes:**
- **Basic Mode** β Memorize **1 image** and answer a quiz.
- **2-Images Mode** β Memorize **2 images**, then answer **combined** quiz questions.
- **4-Images Mode** β Memorize **4 images**, then answer **combined** quiz questions.
- **Timed Mode** β Complete the quiz before the timer runs out!
### **Game Enhancements:**
- **Dynamic AI Quizzes** β Each game is unique!
- **Auto-retry on invalid images** β Ensures AI can process the image.
- **Shuffled Answer Choices** β Prevents pattern-based guessing.
- **Live Timer** β Helps players track time.
---
## **π Ideas for Future Improvements**
- **More Quiz Modes** β Difficulty levels, categories, etc.
- **Leaderboard & Score History** β Compete with friends!
- **User Accounts & Profiles** β Save scores and progress.
- **Multiplayer Mode** β Compete live with others!
---
## **π How to Run SnapQuiz Locally**
### **1. Clone the Repository:**
```bash
git clone https://github.com/cltxvz/snapQuiz.git
```
### **2. Install Backend Dependencies:**
```bash
cd backend
pip install -r requirements.txt
```
### **3. Set Up Environment Variables:**
Create a `.env` file in the **backend** folder and add:
```env
GOOGLE_API_KEY=your-google-gemini-api-key
```
### **4. Start the Backend Server:**
```bash
python app.py
```
or
```bash
flask run
```
### **5. Install & Run the Frontend:**
```bash
cd frontend
npm install
npm start
```
Then, visit:
```
http://localhost:3000
```
---
## **π Live Demo (Hosted on Heroku)**
**SnapQuiz:** [https://snapquiz-frontend-489546fcd686.herokuapp.com/](https://snapquiz-frontend-489546fcd686.herokuapp.com/)
---
## **π€ Author**
**Carlos A. CΓ‘rdenas**
π‘ **If you found this project useful or fun, please star the repo and contribute!** π
---
### **β
Final Notes**
This project was built to **demonstrate AI-powered quiz generation**, integrating **computer vision, web scraping, and game mechanics** into a **seamless full-stack experience**.
Thank you for checking out **SnapQuiz**! π―π§ π