A multilingual desktop AI voice assistant powered by Ollama (Gemma 3) with support for English and Nepali languages. Built with PyQt5 for a modern web-based UI, it provides hands-free voice interaction for various tasks.
- 🎙️ Voice Recognition - Hands-free voice command recognition using Google Speech Recognition
- 🤖 AI-Powered Chat - Powered by Ollama (Gemma 3 4B model) for natural conversations
- 🔊 Text-to-Speech - Uses Piper for high-quality voice output in both English and Nepali
- 🌐 Bilingual Support - Seamlessly switch between English (en) and Nepali (ne)
| Command Type | Examples |
|---|---|
| Web Browsing | "Open YouTube", "Open Google", "Open Facebook" |
| Music | "Play [song name]" - Plays on YouTube |
| Volume | "Volume up", "Volume down" |
| Information | "What's the time?", "Tell me about [topic]" |
| Weather | "What's the weather?" (Kathmandu) |
| Code Generation | "Generate HTML for [description]", "Write Python code for [description]" |
| Entertainment | "Tell me a joke" |
| System | "Open VS Code", "System shutdown" |
| News | "What's the latest news?", "Tell me about [F1/tech/cricket/etc.]" |
- Live News Integration - Fetches latest headlines from Google News RSS feeds
- Topic-Specific News - Specialized news for F1, football, cricket, tech, business, science, politics, health, Nepal, India, USA, UK
- Streaming Speech - Real-time text-to-speech while AI generates responses
- System Tray - Minimize to system tray for background operation
- Smart Intent Detection - AI-powered command classification
- Multi-turn Conversations - Context-aware dialogue sessions
# Core dependencies
sudo apt-get update
sudo apt-get install -y \
python3 \
python3-pip \
libasound2-dev \
portaudio19-dev \
ffmpeg
# Piper TTS (text-to-speech)
# Download from: https://github.com/rhasspy/piperpip install \
PyQt5 \
PyQtWebEngine \
speech_recognition \
requests \
beautifulsoup4 \
pywhatkit \
pyjokes \
ollama~/piper_models/
├── voice.onnx # Default English voice
├── en_US-amy-medium.onnx # English voice model
└── ne_NP-chitwan-medium.onnx # Nepali voice model
-
Clone the repository
cd /home/httpsumang/Downloads/sahayogi-main -
Install Python dependencies
pip install -r requirements.txt
-
Setup Piper TTS
# Download Piper binary and voices cd ~ mkdir -p piper_models cd piper_models # Download Piper executable wget https://github.com/rhasspy/piper/releases/download/2024.11.14/piper-linux-x64.tar.gz tar -xzf piper-linux-x64.tar.gz # Download voice models # English voice wget https://github.com/rhasspy/piper-voices/raw/main/v1/en_US/amy/medium/en_US-amy-medium.onnx wget https://github.com/rhasspy/piper-voices/raw/main/v1/en_US/amy/medium/en_US-amy-medium.onnx.json # Nepali voice wget https://github.com/rhasspy/piper-voices/raw/main/v1/ne_NP/chitwan/medium/ne_NP-chitwan-medium.onnx wget https://github.com/rhasspy/piper-voices/raw/main/v1/ne_NP/chitwan/medium/ne_NP-chitwan-medium.onnx.json
-
Start Ollama
# Ensure Ollama is running with Gemma 3 ollama serve ollama pull gemma3:4b -
Run the application
cd linux/Better_UI python3 V1.py
The assistant listens for a wake word to begin a conversation session. Once activated, you can issue multiple commands in a session.
Starting a Session:
- Simply speak naturally - the assistant detects when you're addressing it
- Say commands like "Hello", "Hey", or any wake phrase
Sample Commands:
User: Open YouTube
Assistant: Opening YouTube.
User: What time is it?
Assistant: The time is 03:45 PM.
User: Tell me about Nepal
Assistant: [Provides information about Nepal with latest news context]
User: Generate HTML for a login form
Assistant: [Generates HTML code and opens it in browser]
User: Switch to Nepali / अब नेपालीमा बोलौं
Assistant: Language switched to Nepali. / भाषा नेपालीमा परिवर्तन भयो।
You can also type commands in the UI's terminal input field instead of using voice.
linux/Better_UI/
├── V1.py # Main application (this file)
├── ui.html # Web-based user interface
├── assets/ # Application assets (logo, icons)
├── news_cache.txt # Cached news data
└── code.html # Generated code output
- PyQt5 - Desktop application framework
- QWebEngineView - Embedded Chromium browser for modern UI
- QWebChannel - JavaScript-Python bridge for bidirectional communication
- speech_recognition - Google Speech Recognition API for STT
- Piper - Neural text-to-speech for natural-sounding voices
- Ollama - Local LLM inference engine
- Gemma 3:4b - Primary AI model
- Smart Intent Detection - AI-powered command classification
- Live System Prompt - Context-aware prompts with news data
- Google News RSS - Source for live headlines
- Topic Detection - Automatic topic extraction from queries
- Caching - Local cache with 3-hour refresh interval
The application supports two languages configured in LANGUAGE_SETTINGS:
LANGUAGE_SETTINGS = {
"en": {
"label": "English",
"speech_lang": "en-US",
"piper_models": ["~/piper_models/en_US-amy-medium.onnx", ...]
},
"ne": {
"label": "नेपाली",
"speech_lang": "ne-NP",
"piper_models": ["~/piper_models/ne_NP-chitwan-medium.onnx", ...]
}
}OLLAMA_MODEL = "gemma3:4b" # Default model
MAX_CHAT_HISTORY = 24 # Conversation history limit"Ollama is not running"
# Start Ollama service
ollama serve
# Pull the model if needed
ollama pull gemma3:4b"Piper not found"
# Verify Piper installation
ls ~/piper_models/piper
ls ~/piper_models/voice.onnx
# Make executable
chmod +x ~/piper_models/piper"Speech recognition not working"
- Check microphone permissions
- Verify internet connection (Google Speech API requires internet)
- Adjust
recognizer.energy_thresholdif needed
"News not loading"
- Check internet connection
- Verify RSS feed accessibility
- Review
news_cache.txtfor cached data
This project is developed for educational and personal use.
- Ollama - For local LLM inference
- Piper - For neural text-to-speech
- Google Speech Recognition - For voice recognition
- PyQt5 - For desktop UI framework