AI-powered flashcard app for students. Snap photos of your notes, AI creates quizzes, study with spaced repetition.
Built for my daughter Emma. 📚
- Photo to Flashcards — Take a photo of your notes/worksheet, AI reads it and generates quiz cards (flashcard, multiple choice, fill-in-the-blank)
- Multi-Image Upload — Select multiple photos at once, all cards merge into one deck
- Subject Folders — Organise decks into folders (Chemistry, History, Maths, etc.)
- Spaced Repetition — SM-2 algorithm schedules cards you struggle with more frequently
- Gamification — Earn XP, level up, unlock achievements, build study streaks
- Works on Phone — Mobile-first design, access from any device on your home network
ollama pull gemma4:31b-cloudAny Ollama-compatible vision model works. You can change it in the app settings.
git clone https://github.com/psylsph/flashlearn.git
cd flashlearn
docker compose up -d --buildhttp://localhost:5050
On your phone (same WiFi): http://<your-computer-ip>:5050
- Create subject folders (optional) — Chemistry, History, etc.
- Tap the camera button — Select one or more photos of your notes
- AI reads your notes — The vision model extracts facts and creates quiz cards
- Study — Flip flashcards, answer multiple choice, type fill-in-the-blank answers
- Earn XP — Correct answers earn XP, build streaks, unlock achievements
| Variable | Default | Description |
|---|---|---|
PORT |
5050 |
Port the app runs on |
OLLAMA_URL |
http://localhost:11434 |
Ollama API base URL |
PDF_MAX_PAGES |
10 |
Maximum PDF pages processed per upload |
PDF_DPI |
150 |
DPI used when rendering PDF pages |
Change the model in the app's Settings page, or edit the database directly. The default is gemma4:31b-cloud.
Any Ollama model with vision capabilities works. For offline/local use:
ollama pull gemma3:4bThen select it in Settings.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/status |
Ollama connection status |
| GET | /api/progress |
XP, level, streaks, stats |
| GET/PUT | /api/settings |
AI model setting |
| GET | /api/folders |
List all folders |
| POST | /api/folders |
Create folder |
| PUT | /api/folders/{id} |
Rename folder |
| DELETE | /api/folders/{id} |
Delete folder |
| GET | /api/decks |
List decks (optional ?folder_id=N) |
| GET | /api/decks/unassigned |
Decks not in any folder |
| POST | /api/decks |
Create empty deck |
| PUT | /api/decks/{id}/move |
Move deck to folder |
| DELETE | /api/decks/{id} |
Delete deck and cards |
| POST | /api/upload |
Upload photo(s), AI generates cards |
| GET | /api/decks/{id}/study |
Get cards for review |
| POST | /api/cards/{id}/review |
Submit card review |
| POST | /api/session/complete |
End study session, award bonus XP |
| DELETE | /api/cards/{id} |
Delete a card |
| GET | /api/achievements |
List achievements |
- Backend: Python, FastAPI, SQLite
- Frontend: Vanilla HTML/CSS/JS (no framework)
- AI: Ollama vision models via local API
- Deployment: Docker with host networking
flashlearn/
├── main.py # FastAPI app and API routes
├── database.py # SQLite schema, SM-2 spaced repetition, XP system
├── ai_service.py # Ollama API integration, image processing
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── static/
│ ├── index.html # Single-page app
│ ├── style.css # Mobile-first dark theme
│ └── app.js # Frontend logic
├── tests/
│ ├── conftest.py # Test fixtures
│ ├── test_database.py # Database, SM-2, achievements tests
│ ├── test_api.py # API endpoint tests
│ └── test_ai_service.py # AI service tests
└── README.md
pip install pytest pytest-asyncio httpx
python -m pytest tests/ -vMIT License — see LICENSE.