README.md
π‘οΈ Police Bot Runtime β AI Voice Assistant for Bengaluru Police This is the runtime layer of an AI-powered mental wellness assistant built for frontline Bengaluru Police officers. The assistant runs locally and privately using an LLM (via Ollama) and a fine-tuned voice cloning TTS model (via XTTS/F5-TTS), producing empathetic voice replies in real-time based on officer input.
π¬ Text In β π€ LLM Reply β π£οΈ Voice Cloned Output
π Project Goals Create a voice-first wellness chatbot for police personnel
Fully private, runs entirely offline on powerful local machines
Replies are generated by an open-source LLM (police-bot) via Ollama
Responses are spoken aloud using a fine-tuned XTTS voice cloned from a real speaker
Easily extendable to integrate into a React-based web interface later
Future support for Kannada via multi-lingual XTTS fine-tuning
π§ System Overview This repo powers the runtime experience.
Ollama runs an LLM (LLaMA 3, Mistral etc.) via the police-bot model
Python script police_runtime.py communicates with Ollama (localhost:11434)
LLM reply is sent to police_bot_voice.py
XTTS reads a voice reference and generates a realistic audio response (output.wav)
Audio is played back to the officer
Example flow:
Officer: I'm feeling low today Assistant: [spoken aloud] Namaskara! Iβm here to support you. You're a valued member of the force...
π Folder Structure Your folder layout should look like:
police-bot-runtime/ β βββ police_runtime.py # Main loop: user input β LLM β voice βββ police_bot_voice.py # Loads XTTS model, speaks response β βββ my_finetuned_model/ # XTTS fine-tuned model files β βββ config.json β βββ dvae.ptj β βββ mel_stats.pth β βββ model.pth β βββ vocab.json β βββ datasets-1/ β βββ wavs/ β βββ 0029.wav # Reference voice clip used for inference β βββ venv/ # Python virtual environment βββ requirements.txt # (Optional) Dependency list
βοΈ Setup Instructions π§© Prerequisites:
Windows 10/11, 64-bit
Python 3.11 (recommended)
Ollama installed: https://ollama.com
Trained XTTS voice model (via F5-TTS or Coqui)
Clone or copy this folder as police-bot-runtime
Create a virtual environment:
bash Copy Edit python -m venv venv venv\Scripts\activate Install dependencies:
bash Copy Edit pip install TTS requests Start the Ollama LLM (separate terminal):
bash Copy Edit ollama run police-bot Run the voice assistant:
bash Copy Edit python police_runtime.py You'll be prompted for input. Replies will be printed and voiced out.
π§ͺ Testing Voice Model Your test_voice.py should look like:
python Copy Edit from TTS.api import TTS
tts = TTS( model_path="my_finetuned_model/", config_path="my_finetuned_model/config.json", gpu=True )
tts.tts_to_file( text="Hey officer, everything okay?", file_path="output.wav", speaker_wav="datasets-1/wavs/0029.wav", language="en" ) π§ How It Works Ollama LLM (LLaMA3) is launched with ollama run police-bot
Text prompt is sent to http://localhost:11434/api/generate
Response is sent to XTTS model for synthesis
XTTS clones voice using speaker_wav file
Audio saved to output.wav and played using playsound or equivalent
π οΈ Future Enhancements Integrate directly with the frontend (React + ShadCN + Web Speech API)
Support both English and Kannada voice cloning
Add emotional sentiment analysis (LLaMA + classifier)
Handle stress journaling and daily wellness logging
Auto-log sessions to Supabase or local DB
Deploy offline on a rugged laptop for field use
π Acknowledgements Voice cloning: F5-TTS / Coqui XTTS
LLM inference: Ollama + LLaMA3 8B
Frontend inspiration: GovSchemes project
This is a labor of respect and service. Designed to support those who protect us.
β