A simple but powerful chatbot that can interact through both voice and text, using state-of-the-art speech recognition and synthesis.
- 💬 Text chat interface
- 🎤 Voice input support
- 🔊 Voice output for all responses
- 🌓 Light/Dark mode toggle
- ⚡ Real-time speech-to-text using Whisper
- 🗣️ Natural-sounding responses using Google Text-to-Speech
- Python 3.11 or higher
- FFmpeg (required for Whisper)
On macOS:
brew install ffmpegOn Ubuntu/Debian:
sudo apt update
sudo apt install ffmpegOn Windows: Download from FFmpeg website
- Clone the repository:
git clone <your-repo-url>
cd <project-directory>- Create a virtual environment (recommended):
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run the application:
python server.py- Open in browser: Visit http://localhost:8000
- Type your message in the input box
- Press Enter or click Send
- The bot will respond with text and voice
- Click the microphone icon 🎤
- Speak your message
- Click the microphone again to stop recording
- The bot will:
- Show your transcribed message
- Respond with text
- Speak its response
- "Hello" - Get a greeting
- "What can you do?" - Learn about capabilities
- "Tell me a joke" - Hear a programming joke
- Ask any question - Get an engaging response
- Frontend: HTML, CSS, JavaScript with jQuery
- Backend: Python with Flask
- Speech Recognition: OpenAI Whisper
- Text-to-Speech: Google Text-to-Speech (gTTS)
- Audio Processing: pydub
Build and run using Docker:
# Build the image
docker build -t voice-chatbot .
# Run the container
docker run -p 8000:8000 voice-chatbot├── server.py # Main Flask application
├── worker.py # Chatbot logic and response handling
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── static/ # Static assets
│ ├── script.js # Frontend JavaScript
│ └── style.css # CSS styles
└── templates/ # HTML templates
└── index.html # Main chat interface
MIT License - Feel free to use and modify for your own projects!