How sagnikdatta2k6/noto-ai-app works
Project type and purpose
• This is a desktop “full-stack” Python application with a Kivy/KivyMD GUI (“frontend”) and a local AI-powered backend.
• Purpose: let users upload and interact with PDFs via Meta’s LLaMA 3 model running locally (through Ollama), while also offering OCR, summarization, search, and user management.
File structure
• Top-level files:
• main.py – entry point, orchestrates app startup
• ads.py – ad/banner logic (UI component)
• ai_service.py – wrapper for HTTP calls to Ollama (LLaMA 3 inference)
• ocr_service.py – image-to-text OCR
• csv_database.py & database.py – persistence layer (users.csv)
• user_management.py – login/signup workflows
• kv/ (Kivy layout files for splash, login, signup, main screens)
• tests/ – unit tests for ai_service
• Requirements.txt specifies dependencies (Kivy, PyMuPDF, etc.)
• No cloud: all inference and data storage are local.
README for additional insights
• Clearly calls out UI tech (Kivy/KivyMD), PDF parsing via PyMuPDF, AI backend via local HTTP API at localhost:11434, optional .env for API URL & model name.
• High-level workflow: PDF → parse → chat/summarize → UI.
a. Main components:
• GUI Layer (Kivy/KivyMD)
• Controller Layer (main.py + user_management.py + ads.py)
• Services Layer
– PDF Parser (PyMuPDF, integrated in ai_service or separate)
– OCR Service (ocr_service.py)
– AI Service (ai_service.py → HTTP to Ollama API)
• Persistence Layer (csv_database.py / database.py + users.csv)
• External Service (Ollama LLaMA 3 model via local REST at localhost:11434)
b. Relationships / data flow:
1. User actions in GUI → Controller
2. For PDF operations: Controller → PDF Parser / OCR → enrich text
3. Controller → AI Service → sends prompt + context → Ollama → receives response
4. Responses flow back to Controller → GUI render
5. User credentials flow: GUI → user_management → csv_database → users.csv → return auth status
c. Architectural patterns & design principles:
• MVC-style separation (kv + main.py as View/Controller; service modules as Model)
• Single process local application, modularized by concern (UI vs. service vs. data)
• Dependency inversion: services behind well-defined interfaces (ai_service, ocr_service)
d. Key technologies:
• Python, Kivy/KivyMD (UI)
• PyMuPDF (fitz) for PDF parsing
• Ollama HTTP API for LLaMA 3 inference
• CSV flat-file database for user data
• pytest for testing ai_service
Elements
• User → GUI interactions
• GUI → Controller → Service calls
• AI Service → HTTP → Ollama → AI Service
• Controller ↔ Database reads/writes
• Blue for UI layer
• Green for service layer (PDF/OCR/AI)
• Orange for persistence
• Gray/striped for external service
Final recommendations
• Be exhaustive: include every Python module as part of its logical layer.
• Asset usage only if it’s directly relevant (e.g., background video in splash screen).
• Use consistent naming matching file names (e.g., ai_service.py → “AI Service”).