Update README.md
Browse files
README.md
CHANGED
|
@@ -14,6 +14,7 @@ For a comprehensive understanding of the models and inference details, please co
|
|
| 14 |
- [Setup](#setup)
|
| 15 |
- [Installation](#installation)
|
| 16 |
- [Run Flask server](#run-flask-server)
|
|
|
|
| 17 |
- [Citation for the original repo](#citation-for-the-original-repo)
|
| 18 |
|
| 19 |
### Setup
|
|
@@ -22,7 +23,7 @@ Some of the large files in this repo are uploaded using git lfs. Install latest
|
|
| 22 |
Some of the large files in this repository have been uploaded using Git-LFS.
|
| 23 |
To ensure seamless handling of these files, please install Git-LFS by executing the provided commands:
|
| 24 |
|
| 25 |
-
```
|
| 26 |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.python.sh | bash
|
| 27 |
sudo apt-get install git-lfs
|
| 28 |
git lfs install
|
|
@@ -32,14 +33,14 @@ The entire repository, including the models, has been uploaded to Hugging Face
|
|
| 32 |
"[Fastspeech2_HS_Flask_API](https://huggingface.co/k-m-irfan/Fastspeech2_HS_Flask_API)" due to size restrictions on GitHub for Git LFS.
|
| 33 |
To clone the repository from Hugging Face, please use the following command:
|
| 34 |
|
| 35 |
-
```
|
| 36 |
git clone https://huggingface.co/k-m-irfan/Fastspeech2_HS_Flask_API
|
| 37 |
```
|
| 38 |
|
| 39 |
Alternatively, you can download the models from the original repository [Fastspeech2_HS](https://github.com/smtiitm/Fastspeech2_HS)
|
| 40 |
and organize the folder structure as specified below. Skip this step if already cloned the repository from Hugging Face.
|
| 41 |
|
| 42 |
-
```
|
| 43 |
models
|
| 44 |
├── hindi
|
| 45 |
│ ├── female
|
|
@@ -58,29 +59,85 @@ models
|
|
| 58 |
### Installation:
|
| 59 |
|
| 60 |
Create a virtual environment and activate it:
|
| 61 |
-
```
|
| 62 |
python3 -m venv tts-hs-hifigan
|
| 63 |
source tts-hs-hifigan/bin/activate
|
| 64 |
```
|
| 65 |
|
| 66 |
Install the required dependencies by running:
|
| 67 |
-
```
|
| 68 |
pip install -r requirements.txt
|
| 69 |
```
|
| 70 |
|
| 71 |
### Run Flask server:
|
| 72 |
Ensure the server application is running correctly before proceeding. Use the following commands and check for any errors:
|
| 73 |
-
```
|
| 74 |
python3 flask_app.py
|
| 75 |
# OR
|
| 76 |
gunicorn -w 2 -b 0.0.0.0:5000 flask_app:app --timeout 600
|
| 77 |
```
|
| 78 |
|
| 79 |
If the application is running without any issues, proceed to start the server using the following command:
|
| 80 |
-
```
|
| 81 |
bash start.sh
|
| 82 |
```
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
### Citation for the original repo
|
| 85 |
If you use this Fastspeech2 Model in your research or work, please consider citing:
|
| 86 |
|
|
@@ -94,7 +151,6 @@ ELECTRICAL ENGINEERING,
|
|
| 94 |
IIT MADRAS. ALL RIGHTS RESERVED "
|
| 95 |
|
| 96 |
|
| 97 |
-
|
| 98 |
Shield: [![CC BY 4.0][cc-by-shield]][cc-by]
|
| 99 |
|
| 100 |
This work is licensed under a
|
|
|
|
| 14 |
- [Setup](#setup)
|
| 15 |
- [Installation](#installation)
|
| 16 |
- [Run Flask server](#run-flask-server)
|
| 17 |
+
- [API](#api)
|
| 18 |
- [Citation for the original repo](#citation-for-the-original-repo)
|
| 19 |
|
| 20 |
### Setup
|
|
|
|
| 23 |
Some of the large files in this repository have been uploaded using Git-LFS.
|
| 24 |
To ensure seamless handling of these files, please install Git-LFS by executing the provided commands:
|
| 25 |
|
| 26 |
+
```bash
|
| 27 |
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.python.sh | bash
|
| 28 |
sudo apt-get install git-lfs
|
| 29 |
git lfs install
|
|
|
|
| 33 |
"[Fastspeech2_HS_Flask_API](https://huggingface.co/k-m-irfan/Fastspeech2_HS_Flask_API)" due to size restrictions on GitHub for Git LFS.
|
| 34 |
To clone the repository from Hugging Face, please use the following command:
|
| 35 |
|
| 36 |
+
```bash
|
| 37 |
git clone https://huggingface.co/k-m-irfan/Fastspeech2_HS_Flask_API
|
| 38 |
```
|
| 39 |
|
| 40 |
Alternatively, you can download the models from the original repository [Fastspeech2_HS](https://github.com/smtiitm/Fastspeech2_HS)
|
| 41 |
and organize the folder structure as specified below. Skip this step if already cloned the repository from Hugging Face.
|
| 42 |
|
| 43 |
+
```bash
|
| 44 |
models
|
| 45 |
├── hindi
|
| 46 |
│ ├── female
|
|
|
|
| 59 |
### Installation:
|
| 60 |
|
| 61 |
Create a virtual environment and activate it:
|
| 62 |
+
```bash
|
| 63 |
python3 -m venv tts-hs-hifigan
|
| 64 |
source tts-hs-hifigan/bin/activate
|
| 65 |
```
|
| 66 |
|
| 67 |
Install the required dependencies by running:
|
| 68 |
+
```bash
|
| 69 |
pip install -r requirements.txt
|
| 70 |
```
|
| 71 |
|
| 72 |
### Run Flask server:
|
| 73 |
Ensure the server application is running correctly before proceeding. Use the following commands and check for any errors:
|
| 74 |
+
```bash
|
| 75 |
python3 flask_app.py
|
| 76 |
# OR
|
| 77 |
gunicorn -w 2 -b 0.0.0.0:5000 flask_app:app --timeout 600
|
| 78 |
```
|
| 79 |
|
| 80 |
If the application is running without any issues, proceed to start the server using the following command:
|
| 81 |
+
```bash
|
| 82 |
bash start.sh
|
| 83 |
```
|
| 84 |
|
| 85 |
+
### API
|
| 86 |
+
```python
|
| 87 |
+
"""
|
| 88 |
+
This is a sample API code to send a text to the server and recieve speech
|
| 89 |
+
for the given text.
|
| 90 |
+
|
| 91 |
+
Supported languages:
|
| 92 |
+
|
| 93 |
+
Assamese, Bengali, Bodo, Gujarati, Hindi, Kannada, Malayalam, Manipuri
|
| 94 |
+
Marathi, Odia, Punjabi, Rajasthani, Tamil, Telugu, Urdu
|
| 95 |
+
|
| 96 |
+
"""
|
| 97 |
+
import requests
|
| 98 |
+
import json
|
| 99 |
+
import base64
|
| 100 |
+
|
| 101 |
+
# endpoint
|
| 102 |
+
url = "http://localhost:5000/tts"
|
| 103 |
+
|
| 104 |
+
lang = 'hindi'
|
| 105 |
+
gender = 'female'
|
| 106 |
+
text = "सुप्रभात, आप कैसे हैं?" # hindi
|
| 107 |
+
# text = "സുപ്രഭാതം, സുഖമാ?" # malayalam
|
| 108 |
+
# text = "সুপ্ৰভাত, তুমি কেনে?" # manipuri
|
| 109 |
+
# text = "सुप्रभात, तुम्ही कसे आहात?" # marathi
|
| 110 |
+
# text = "ಶುಭೋದಯ, ನೀವು ಹೇಗಿದ್ದೀರಿ?" # kannada
|
| 111 |
+
# text = "बसु म्विथ्बो, बरि दिबाबो?" # bodo male yet to be added <---
|
| 112 |
+
# text = "Good morning, how are you?" # english
|
| 113 |
+
# text = "সুপ্ৰভাত, আপুনি কেমন আছে?" # assamese
|
| 114 |
+
# text = "காலை வணக்கம், நீங்கள் எப்படி இருக்கின்றீர்கள்?" # tamil
|
| 115 |
+
# text = "ସୁପ୍ରଭାତ, ଆପଣ କେମିତି ଅଛନ୍ତି?"
|
| 116 |
+
# text = "सुप्रभात, आप कैसे छो?" # rajasthani
|
| 117 |
+
# text = "శుభోదయం, మీరు ఎలా ఉన్నారు?" # telugu
|
| 118 |
+
# text = "সুপ্রভাত, আপনি কেমন আছেন?" # bengali
|
| 119 |
+
# text = "સુપ્રભાત, તમે કેમ છો?" # gujarati
|
| 120 |
+
|
| 121 |
+
payload = json.dumps(
|
| 122 |
+
{
|
| 123 |
+
"input": text,
|
| 124 |
+
"gender": gender,
|
| 125 |
+
"lang": lang,
|
| 126 |
+
"alpha": 1 # to control speed
|
| 127 |
+
})
|
| 128 |
+
|
| 129 |
+
headers = {'Content-Type': 'application/json'}
|
| 130 |
+
response = requests.request("POST", url, headers=headers, data=payload).json()
|
| 131 |
+
|
| 132 |
+
# save the received encoded audio
|
| 133 |
+
audio = response['audio']
|
| 134 |
+
file_name = "tts.wav"
|
| 135 |
+
wav_file = open(file_name,'wb')
|
| 136 |
+
decode_string = base64.b64decode(audio)
|
| 137 |
+
wav_file.write(decode_string)
|
| 138 |
+
wav_file.close()
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
### Citation for the original repo
|
| 142 |
If you use this Fastspeech2 Model in your research or work, please consider citing:
|
| 143 |
|
|
|
|
| 151 |
IIT MADRAS. ALL RIGHTS RESERVED "
|
| 152 |
|
| 153 |
|
|
|
|
| 154 |
Shield: [![CC BY 4.0][cc-by-shield]][cc-by]
|
| 155 |
|
| 156 |
This work is licensed under a
|