--- title: Voice Chat Assistant emoji: 🐢 colorFrom: gray colorTo: blue sdk: docker pinned: false license: apache-2.0 --- # Voice-Enabled Chat Application This is a web-based chat application that allows users to interact with a personal assistant through both text and voice. It features a clean user interface with light and dark modes and voice input. ## Features - **Personal Assistant:** The backend is powered by the Groq API to provide helpful and conversational responses. - **Text and Voice Input:** Users can type messages or use their microphone to speak to the assistant. - **Light/Dark Mode:** The user interface can be switched between light and dark themes for user comfort. - **Multi-language Speech-to-Text:** Users can select from multiple languages for speech-to-text transcription. - **Docker Support:** The application can be easily containerized and deployed using Docker. ## Technologies Used - **Docker** ### Frontend - HTML5 - CSS3 - JavaScript - jQuery - Bootstrap - Font Awesome ### Backend - Python - Flask - Flask-Cors - Groq API - SpeechRecognition ## Prerequisites - Python 3.x - `pip` for installing Python packages - A Groq API key ## Installation and Setup 1. **Clone the repository:** ```bash git clone https://github.com/your-username/chatapp-with-voice.git cd chatapp-with-voice ``` 2. **Create a virtual environment (optional but recommended):** ```bash python -m venv env source env/bin/activate # On Windows, use `env\Scripts\activate` ``` 3. **Install the required Python packages:** ```bash pip install -r requirements.txt ``` 4. **Set up your environment variables:** Create a `.env` file in the root of the project and add your Groq API key: ``` GROQ_API_KEY=your_groq_api_key ``` ## Usage To run the application, execute the following command from the root of the project: ```bash python -u server.py ``` The application will be available at `http://localhost:8000`. ## Project Structure ``` . ├── Dockerfile ├── LICENSE ├── README.md ├── requirements.txt ├── server.py ├── static │ ├── js │ │ ├── WebAudioRecorder.min.js │ │ └── WebAudioRecorderWav.min.js │ ├── script.js │ └── style.css ├── templates │ └── index.html └── worker.py ``` - `server.py`: The main Flask application file that handles routing and serves the web pages. - `worker.py`: Contains the core logic for speech-to-text and processing user messages with the Groq API. - `static/`: Contains the frontend JavaScript and CSS files. - `templates/`: Contains the HTML templates for the web pages. - `requirements.txt`: A list of the Python packages required for the project. - `Dockerfile`: Allows for building a Docker image of the application. ## License This project is licensed under the terms of the Apache-2.0 license. See the `LICENSE` file for more details.