An AI-powered study assistant that ingests documents, generates flashcards, answers questions, and helps you study smarter — all from a clean web interface.
- Document Upload — PDF, DOCX, TXT, images (OCR), audio/video (Gemini transcription), URLs
- AI Chat — Ask questions about your uploaded documents, get cited answers
- Flashcards — Auto-generated, flippable, exportable as JSON or CSV
- Study Tools — Study guide, briefing doc, FAQ, timeline, practice questions with answer checking
- Important Points — Extracted key points with Wikipedia verification
- Calendar — Weekly planner with conflict detection and weekend summaries
- Web Mode — Summarise any URL and browse your web history
| Layer | Technology |
|---|---|
| Backend | FastAPI + SQLAlchemy (SQLite) |
| AI Engine | Google Gemini 2.5 Flash |
| Parser | pypdf, python-docx, Pillow, pytesseract, Gemini vision |
| Frontend | Vanilla HTML/CSS/JS (dark theme SPA) |
| Testing | pytest + Hypothesis (property-based) |
NoteBot-AI/
├── app/
│ ├── db/
│ │ ├── database.py # SQLAlchemy engine + session
│ │ └── init_db.py # Table creation on startup
│ ├── models/
│ │ └── models.py # ORM models (7 tables)
│ ├── routers/
│ │ ├── upload.py # POST /api/upload/file|url
│ │ ├── chat.py # POST /api/chat/query
│ │ ├── flashcards.py # GET/POST /api/flashcards/
│ │ ├── important_points.py
│ │ ├── study_tools.py # study guide, FAQ, timeline, Q&A
│ │ ├── calendar.py # weekly planner
│ │ └── web_mode.py # URL summariser
│ ├── services/
│ │ ├── parser.py # multi-format document parser
│ │ └── ai_engine.py # Gemini AI wrapper
│ └── main.py # FastAPI app + error handlers
├── frontend/
│ ├── index.html
│ ├── style.css
│ └── app.js
├── tests/
│ ├── test_db_properties.py
│ └── test_parser_properties.py
├── .env
├── .gitignore
└── requirements.txt
git clone <repo-url>
cd NoteBot-AI
python -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/Linuxpip install fastapi uvicorn sqlalchemy pypdf python-docx Pillow pytesseract \
hypothesis pytest python-multipart pydantic google-genai python-dotenv- Go to aistudio.google.com/apikey
- Sign in with any Google account
- Click Create API key in new project
- Copy the key
Create a .env file in the project root:
GEMINI_API_KEY=your_key_here
venv\Scripts\uvicorn.exe app.main:app --reloadOpen http://localhost:8000 in your browser.
The full interactive API docs are available at http://localhost:8000/docs.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/upload/file |
Upload a file |
| POST | /api/upload/url |
Ingest a URL or YouTube link |
| GET | /api/upload/documents |
List all documents |
| DELETE | /api/upload/documents/{id} |
Delete a document |
| POST | /api/chat/query |
Ask a question |
| GET | /api/chat/history |
Chat history |
| GET | /api/flashcards/{doc_id} |
Get/generate flashcards |
| POST | /api/flashcards/{doc_id}/regenerate |
Regenerate flashcards |
| GET | /api/flashcards/{doc_id}/export |
Export JSON or CSV |
| POST | /api/study/study-guide |
Generate study guide |
| POST | /api/study/faq |
Generate FAQ |
| POST | /api/study/timeline |
Extract timeline |
| POST | /api/study/questions |
Generate practice questions |
| POST | /api/study/answer-check |
Evaluate an answer |
| GET | /api/calendar/week |
Get week entries |
| POST | /api/calendar/entry |
Add calendar entry |
| POST | /api/web/summarise |
Summarise a URL |
| GET | /api/web/history |
Web browsing history |
| DELETE | /api/web/history |
Clear web history |
venv\Scripts\pytest.exe tests/ -v3 property-based tests using Hypothesis:
- Document metadata round trip (100 examples)
- Parser TXT round trip (25 examples)
- Unsupported format error (25 examples)
| Format | Method |
|---|---|
.txt |
stdlib |
.pdf |
pypdf |
.docx |
python-docx |
.png .jpg .jpeg .webp .bmp .tiff |
pytesseract OCR + Gemini vision fallback |
.mp3 .wav .mp4 |
Gemini Files API transcription |
| URLs | httpx + BeautifulSoup |
| YouTube | youtube-transcript-api |
Note: pytesseract requires the Tesseract binary installed on your system.
- The Gemini free tier allows ~20 requests/day on
gemini-2.5-flash. Quota resets daily at midnight Pacific time. - Never commit your
.envfile — it's in.gitignore. - Switch
DATABASE_URLenv var to a PostgreSQL connection string for production.