A simple Gradio web application that converts text input into an audio file.
- Converts text to speech using Google Text-to-Speech (
gTTS
). - Outputs audio in WAV if
ffmpeg
andpydub
are installed. - User-friendly web interface powered by Gradio.
- Can ask question from any LLM (change
model
variable and its corresponding API key in app.py) - The response of LLM is then converted into audio file (wav format)
-
Clone the repository:
git clone https://github.com/danchou99/text-to-audio-gradio.git cd text-to-audio-gradio
-
Create and activate a virtual environment:
python -m venv .venv # On Windows (PowerShell): .venv\Scripts\Activate.ps1 # On Windows (Command Prompt): .venv\Scripts\activate.bat # On macOS/Linux: source .venv/bin/activate
-
Install dependencies:
pip install -r requirements.txt
- Note for WAV output: If you intend to use the WAV output version, you also need to install
ffmpeg
on your system and ensure it's in your system's PATH. Refer to FFmpeg website for installation instructions.
- Note for WAV output: If you intend to use the WAV output version, you also need to install
- Activate your virtual environment (if not already active).
- Run the Gradio application:
python app.py
- Open the provided URL (e.g.,
http://127.0.0.1:7860
) in your web browser.
- Enter your desired text in the input box.
- Click the "Submit" button.
- The generated audio will appear below, which you can play or download.
Feel free to fork this repository, make improvements, and submit pull requests.
NAM