# Using Coqui Local

Navigate to [Coqui](https://coqui.ai/) and click on the **Get Started** button.

> Coqui.ai has been discontinued, but enthusiasts can still set up Coqui locally by following the instructions below.

> Coqui Local Branch has not yet been merged.

### Setting Up Coqui Locally

#### Method 1: Manual Setup

1. Create a directory for Coqui and navigate to it:

   ```bash
   mkdir ~/coqui && cd ~/coqui
   ```
2. Download and install Miniconda:

   ```bash
   curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o miniconda3.sh
   chmod +x ./miniconda3.sh
   ./miniconda3.sh
   ```
3. Create a Conda environment and install Python 3.10:

   ```bash
   conda create --name coqui python=3.10
   conda activate coqui
   ```
4. Clone the Coqui TTS repository:

   ```bash
   git clone https://github.com/coqui-ai/TTS.git
   ```
5. Install dependencies:

   ```bash
   brew install mecab espeak
   pip install numpy==1.21.6 flask_cors
   conda install scipy scikit-learn Cython
   ```
6. Navigate to the cloned `TTS` directory and install Coqui TTS:

   ```bash
   cd TTS && make install
   ```
7. Run the local Coqui TTS server:

   ```bash
   python3 TTS/server/server.py --model_name tts_models/en/vctk/vits
   ```

#### Method 2: Setup via Docker

1. Pull the Coqui TTS Docker image:

   ```bash
   docker pull ghcr.io/coqui-ai/tts --platform linux/amd64
   ```
2. Run the Coqui TTS container:

   ```bash
   docker run --rm -it -p 5002:5002 --entrypoint /bin/bash ghcr.io/coqui-ai/tts
   ```
3. Inside the container, install Flask CORS and run the server:

   ```bash
   pip install flask_cors
   python3 TTS/server/server.py --model_name tts_models/en/vctk/vits
   ```

### Adding CORS Support

To ensure that the Coqui server allows cross-origin resource sharing (CORS), add the following lines to Flask app in `/TTS/server/server.py` :

```python
from flask_cors import CORS

CORS(app)
```

### Make sure Coqui is enabled for TTS:

```bash
Settings -> Text-to-Speech -> TTS Backend -> Coqui
```

### Proceed to make a new voice. When you are satisfied, copy the **Voice ID**.

```bash
Settings -> Text-to-Speech -> Coqui -> Voice ID
```

#### Notes

* Coqui TTS can be used as a local text-to-speech backend in your application.
* If you want to explore more models or functionalities, refer to the official [Coqui TTS GitHub repository](https://github.com/coqui-ai/TTS).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.heyamica.com/connecting-speech-options-tts/using-coqui.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
