项目
在 GitHub 查看
ahmedbadr-dev/voice-ai-assistant
关于
Python voice AI assistant: microphone STT, Google Gemini answers, offline TTS with pyttsx3. Clean env-based setup.
人工智能与机器学习可以做什么
- Speech-to-text via Google Speech Recognition (default locale: Egyptian Arabic ar-EG)
- LLM answers powered by Google Gemini
- Text-to-speech replies with pyttsx3 (system voices)
- Exit phrases in Arabic / English (وداعاً, خروج, bye, exit, …)
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Voice AI Assistant
A small Python voice assistant that listens through your microphone, sends your speech to Google Gemini, and speaks the reply back using offline TTS (pyttsx3).
Built as a focused demo of speech recognition + generative AI + text-to-speech on Windows.
Features
- Speech-to-text via Google Speech Recognition (default locale: Egyptian Arabic
ar-EG) - LLM answers powered by Google Gemini
- Text-to-speech replies with
pyttsx3(system voices) - Exit phrases in Arabic / English (
وداعاً,خروج,bye,exit, …) - Config via
.env— no API keys in source code
Project layout
AI_Assistant_Project/
├── assistant.py # Main voice loop
├── test_tts.py # Optional TTS smoke test
├── requirements.txt
├── .env.example
└── README.md
Requirements
- Python 3.11+ recommended
- Working microphone
- Windows: a system voice pack (Arabic voice optional for nicer Arabic TTS)
- Gemini API key from Google AI Studio
Setup
cd AI_Assistant_Project
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
# source .venv/bin/activate
pip install -r requirements.txt
copy .env.example .env # Windows
# cp .env.example .env # macOS / Linux
Edit .env and set:
GOOGLE_API_KEY=your_key_here
PyAudio on Windows
If pip install PyAudio fails, install a matching wheel for your Python version, or use:
pip install pipwin
pipwin install pyaudio
Run
python assistant.py
Speak after “Listening…”. Say goodbye / خروج / وداعاً to stop.
Optional TTS check:
python test_tts.py
Configuration
| Variable | Default | Description |
|---|---|---|
GOOGLE_API_KEY |
— | Required Gemini API key |
GEMINI_MODEL |
gemini-2.0-flash |
Model id |
LISTEN_LANGUAGE |
ar-EG |
Speech recognition locale |
TTS_RATE |
160 |
Words-per-minute for pyttsx3 |
How it works
- Capture microphone audio (
SpeechRecognition+PyAudio) - Transcribe with Google Speech API
- Send text prompt to Gemini
- Speak the model’s reply with
pyttsx3
Security notes
- Never commit
.envor hard-code API keys - If a key was ever pasted into source, rotate it in Google AI Studio
Author
Portfolio / learning project — voice interface around Google Gemini.
License
MIT
探索相关项目
加载中…