Smart Notes is a lightweight local AI application that lets you summarize text, generate bullet summaries, create quizzes, and ask questions β all powered entirely by Ollama running locally. It provides a simple frontend interface and a Flask backend that interacts with a local LLM (e.g., llama3.2:3b).
This project is ideal for beginners who want to understand how to:
- Connect a frontend to a backend
- Make API calls to a local LLM
- Parse and format streamed model responses
- Build a simple real-world AI application
smart-notes/
β
βββ README.md (this file)
β
βββ backend/
β βββ app.py
β βββ requirements.txt
β βββ .venv/
β
βββ frontend/
β βββ index.html
The backend is a Python Flask server that exposes API endpoints used by the frontend. It communicates with Ollama running on the userβs machine.
- Receives text from the frontend
- Sends chat requests to Ollama (
/api/chatendpoint) - Parses NDJSON streamed output from Ollama
- Merges chunks into a full assistant message
- Returns clean JSON responses back to the frontend
| Endpoint | Method | Purpose |
|---|---|---|
/api/summarize |
POST | Create a summary (normal or bulleted) |
/api/quiz |
POST | Generate quiz questions from text |
/api/ask |
POST | Ask arbitrary questions about the text |
body = request.json
text = body.get("text", "")messages = [
{"role": "system", "content": "You are an assistant..."},
{"role": "user", "content": user_prompt}
]resp = requests.post("http://localhost:11434/api/chat", json=payload)Ollama returns multiple JSON objects, each one a token chunk. The code merges them into one coherent assistant message.
{
"ok": true,
"text": "Final summarized output..."
}The frontend provides a clean UI for interacting with the backend.
-
Textarea for input
-
Buttons: Summarize, Bulleted Summary, Make Quiz, Ask Question
-
Output area with formatted HTML rendering
-
JavaScript handles:
- Fetching API calls
- Displaying loading state
- Converting backend JSON into readable formatted UI
Calls:
summarize("normal")fetch('/api/summarize', {...})The frontend uses a helper formatAssistantText() to convert:
\nβ HTML paragraphs- list markers
*,-β bullet lists **bold**β<strong>
document.getElementById('result').innerHTML = formattedHTML;Follow these steps to run Smart Notes on your own computer.
Go to: https://ollama.com/download
Then install a model:
ollama pull llama3.2:3bOpen PowerShell as Administrator:
wsl --installReboot.
git clone <your-repo-url>
cd smart-notes/backendpython3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtRequired packages include:
- Flask
- Requests
- (Optional) python-dotenv
python app.pyYou will see:
Running on http://127.0.0.1:5000
Open frontend/index.html in your browser.
Note: It directly calls /api/... on the Flask backend.
To test without UI:
curl -X POST http://127.0.0.1:5000/api/summarize \
-H "Content-Type: application/json" \
-d '{"text":"Hello world. Summarize this."}'- Chat history
- Markdown rendering
- Model selector dropdown
- PDF export
- Voice-to-text input
- Using embeddings + RAG
If you'd like, I can help implement any of these.
Pull requests are welcome!
- Keep code simple
- Use clear comments
- Ensure formatting works even for multi-paragraph LLM output
MIT License β free for personal and commercial use.