How rahullkumr/padh-ke-batao works
Padh Ke Batao is a local-first document explainer: a person selects or drops a document photo, the browser resizes it, and the server streams a Hindi or English explanation produced by a local Ollama model. The result highlights actions, deadlines, and urgency; the Listen feature uses ElevenLabs when configured, otherwise an installed local voice. The README documents the privacy boundary and major features; connections for unsampled HTML and service internals are limited to those documented relationships.
Main entry points: server.js Fastify server · ollama.js Model request and stream · app.js Photo and results UI · speech.js Speech playback
Components 16
Browser experience
- App page
public/index.html - Photo and results UI
public/js/app.js - Hindi and English text
public/js/i18n.js - Speech playback
public/js/speech.js
Application server
- Fastify server
src/server.js - Page and asset serving
src/routes/pages.js - Runtime settings
src/config.js - Photo explanation endpoint
src/routes/explain.js - Speech endpoints
src/routes/speak.js
Document explanation
- Explanation prompt and schema
src/prompts/explain-document.js - Model request and stream
src/services/ollama.js
Read aloud
- ElevenLabs speech service
src/services/elevenlabs.js
Other components
- Document reader
- Installed system voice
- Local Ollama model
- ElevenLabs
Connections 25
- Document reader → App page: opens app
README.md - App page → Photo and results UI: loads interface
README.md - Photo and results UI → Hindi and English text: uses text
public/js/app.js - Photo and results UI → Speech playback: initializes playback
public/js/app.js - Photo and results UI → Photo explanation endpoint: posts resized photo
public/js/app.js - Photo explanation endpoint → Model request and stream: requests explanation
src/routes/explain.js - Model request and stream → Explanation prompt and schema: builds model prompt
src/services/ollama.js - Model request and stream → Local Ollama model: sends image and prompt
README.md - Local Ollama model → Model request and stream: streams answer
src/services/ollama.js - Model request and stream → Photo explanation endpoint: returns parsed result
src/routes/explain.js - Photo explanation endpoint → Photo and results UI: streams progress and result
src/routes/explain.js - Fastify server → Photo explanation endpoint: registers route
src/server.js - Fastify server → Speech endpoints: registers route
src/server.js - Fastify server → Page and asset serving: registers route
src/server.js - Fastify server → Model request and stream: warms model
src/server.js - Fastify server → Runtime settings: reads settings
src/server.js - Page and asset serving → App page: serves page assets
src/routes/pages.js - Speech playback → Hindi and English text: uses text
public/js/speech.js - Speech playback → Speech endpoints: requests audio
README.md - Speech playback → Installed system voice: falls back to
public/js/speech.js - Speech endpoints → ElevenLabs speech service: requests speech
src/routes/speak.js - ElevenLabs speech service → ElevenLabs: sends spoken text
README.md - ElevenLabs → ElevenLabs speech service: returns audio stream
src/services/elevenlabs.js - Speech endpoints → Speech playback: returns audio or status
src/routes/speak.js - Fastify server → ElevenLabs speech service: checks voice availability
src/server.js