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. โ€”