mboushaba commited on
Commit
f6bbb30
·
verified ·
1 Parent(s): f80b004

Upload 4 files

Browse files
Files changed (4) hide show
  1. .gitignore +5 -0
  2. app.py +19 -0
  3. coqui_tts.py +15 -0
  4. requirements.txt +216 -0
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ venv
2
+ .idea
3
+ *.pyc
4
+ *.iml
5
+ *.wav
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ from coqui_tts import CoquiTTS
4
+
5
+
6
+ def speech(text, audio):
7
+ coqui_tts = CoquiTTS(speaker_wave_file = audio)
8
+ return coqui_tts.speech_text_and_save_it(text, "output.wav")
9
+
10
+
11
+ interface = gr.Interface(
12
+ fn = speech,
13
+ inputs = [gr.Textbox(placeholder = "Your text to speech here"),
14
+ gr.Audio(sources = ["microphone"], type = "filepath")],
15
+ outputs = [gr.Audio(label = "File path")]
16
+ , allow_flagging = "never")
17
+
18
+ if __name__ == '__main__':
19
+ interface.launch()
coqui_tts.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from TTS.api import TTS
3
+
4
+
5
+ class CoquiTTS:
6
+ def __init__(self, speaker_wave_file):
7
+ self.device = "cuda" if torch.cuda.is_available() else "cpu"
8
+ self.tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(self.device)
9
+ self.speaker_wave_file = speaker_wave_file
10
+
11
+ def speech_text_and_save_it(self, text, output_path, language = "en"):
12
+ return self.tts.tts_to_file(text = text,
13
+ speaker_wav = self.speaker_wave_file,
14
+ language = language,
15
+ file_path = output_path)
requirements.txt ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.1.0
2
+ aiofiles==23.2.1
3
+ aiohappyeyeballs==2.4.3
4
+ aiohttp==3.11.8
5
+ aiosignal==1.3.1
6
+ annotated-types==0.7.0
7
+ anyascii==0.3.2
8
+ anyio==4.6.2.post1
9
+ argbind==0.3.9
10
+ asttokens==3.0.0
11
+ async-timeout==5.0.1
12
+ attrs==24.2.0
13
+ audioread==3.0.1
14
+ babel==2.16.0
15
+ bangla==0.0.2
16
+ blinker==1.9.0
17
+ blis==0.7.11
18
+ bnnumerizer==0.0.2
19
+ bnunicodenormalizer==0.1.7
20
+ cachetools==5.5.0
21
+ catalogue==2.0.10
22
+ certifi==2024.8.30
23
+ cffi==1.17.1
24
+ charset-normalizer==3.4.0
25
+ click==8.1.7
26
+ cloudpathlib==0.20.0
27
+ confection==0.1.5
28
+ contourpy==1.2.1
29
+ coqpit==0.0.17
30
+ cycler==0.12.1
31
+ cymem==2.0.10
32
+ Cython==3.0.11
33
+ dateparser==1.1.8
34
+ decorator==4.4.2
35
+ descript-audiotools==0.7.2
36
+ distro==1.9.0
37
+ docopt==0.6.2
38
+ docstring_parser==0.16
39
+ einops==0.8.0
40
+ encodec==0.1.1
41
+ exceptiongroup==1.2.2
42
+ executing==2.1.0
43
+ fastapi==0.115.4
44
+ ffmpy==0.4.0
45
+ filelock==3.16.1
46
+ fire==0.7.0
47
+ Flask==3.1.0
48
+ flatten-dict==0.4.2
49
+ fonttools==4.54.1
50
+ frozenlist==1.5.0
51
+ fsspec==2024.10.0
52
+ future==1.0.0
53
+ g2pkk==0.1.2
54
+ google-api-core==2.23.0
55
+ google-api-python-client==2.153.0
56
+ google-auth==2.36.0
57
+ google-auth-httplib2==0.2.0
58
+ google-auth-oauthlib==1.2.1
59
+ googleapis-common-protos==1.63.1
60
+ gradio==4.44.1
61
+ gradio_client==1.3.0
62
+ grpcio==1.68.0
63
+ gruut==2.2.3
64
+ gruut-ipa==0.13.0
65
+ gruut-lang-de==2.0.1
66
+ gruut-lang-en==2.0.1
67
+ gruut-lang-es==2.0.1
68
+ gruut-lang-fr==2.0.2
69
+ h11==0.14.0
70
+ hangul-romanize==0.1.0
71
+ httpcore==1.0.6
72
+ httplib2==0.22.0
73
+ httpx==0.27.2
74
+ huggingface-hub==0.26.2
75
+ idna==3.10
76
+ imageio==2.36.0
77
+ imageio-ffmpeg==0.5.1
78
+ importlib_metadata==8.5.0
79
+ importlib_resources==6.4.5
80
+ inflect==7.4.0
81
+ ipython==8.18.1
82
+ itsdangerous==2.2.0
83
+ jamo==0.4.1
84
+ jedi==0.19.2
85
+ jieba==0.42.1
86
+ Jinja2==3.1.4
87
+ jiter==0.7.1
88
+ joblib==1.4.2
89
+ jsonlines==1.2.0
90
+ julius==0.2.7
91
+ kiwisolver==1.4.7
92
+ langcodes==3.5.0
93
+ language_data==1.3.0
94
+ lazy_loader==0.4
95
+ librosa==0.10.0
96
+ llvmlite==0.43.0
97
+ marisa-trie==1.2.1
98
+ Markdown==3.7
99
+ markdown-it-py==3.0.0
100
+ markdown2==2.5.1
101
+ MarkupSafe==2.1.5
102
+ matplotlib==3.8.4
103
+ matplotlib-inline==0.1.7
104
+ mdurl==0.1.2
105
+ more-itertools==10.5.0
106
+ moviepy==1.0.3
107
+ mpmath==1.3.0
108
+ msgpack==1.1.0
109
+ multidict==6.1.0
110
+ murmurhash==1.0.11
111
+ mutagen==1.47.0
112
+ natsort==8.4.0
113
+ networkx==2.8.8
114
+ nltk==3.9.1
115
+ num2words==0.5.13
116
+ numba==0.60.0
117
+ numpy==1.22.0
118
+ oauthlib==3.2.2
119
+ openai==1.55.0
120
+ opencv-python==4.10.0.84
121
+ orjson==3.10.10
122
+ packaging==24.1
123
+ pandas==1.5.3
124
+ parso==0.8.4
125
+ pexpect==4.9.0
126
+ pillow==10.3.0
127
+ platformdirs==4.3.6
128
+ pooch==1.8.2
129
+ preshed==3.0.9
130
+ proglog==0.1.10
131
+ prompt_toolkit==3.0.48
132
+ propcache==0.2.0
133
+ proto-plus==1.25.0
134
+ protobuf==3.19.6
135
+ psutil==6.1.0
136
+ ptyprocess==0.7.0
137
+ pure_eval==0.2.3
138
+ pyasn1==0.6.1
139
+ pyasn1_modules==0.4.1
140
+ pycparser==2.22
141
+ pydantic==2.9.2
142
+ pydantic_core==2.23.4
143
+ pydub==0.25.1
144
+ Pygments==2.18.0
145
+ pyloudnorm==0.1.1
146
+ pynndescent==0.5.13
147
+ pyparsing==3.2.0
148
+ pypinyin==0.53.0
149
+ pysbd==0.3.4
150
+ pystoi==0.4.1
151
+ python-crfsuite==0.9.11
152
+ python-dateutil==2.9.0.post0
153
+ python-dotenv==1.0.1
154
+ python-multipart==0.0.16
155
+ pytz==2024.2
156
+ PyYAML==6.0.2
157
+ randomname==0.2.1
158
+ regex==2024.11.6
159
+ requests==2.32.3
160
+ requests-oauthlib==2.0.0
161
+ rich==13.9.3
162
+ rsa==4.9
163
+ ruff==0.7.1
164
+ safetensors==0.4.5
165
+ schedule==1.2.2
166
+ scikit-learn==1.5.2
167
+ scipy==1.11.4
168
+ semantic-version==2.10.0
169
+ shellingham==1.5.4
170
+ six==1.16.0
171
+ smart-open==7.0.5
172
+ sniffio==1.3.1
173
+ soundfile==0.12.1
174
+ soxr==0.5.0.post1
175
+ spacy==3.7.5
176
+ spacy-legacy==3.0.12
177
+ spacy-loggers==1.0.5
178
+ srsly==2.4.8
179
+ stack-data==0.6.3
180
+ starlette==0.41.2
181
+ SudachiDict-core==20241021
182
+ SudachiPy==0.6.9
183
+ sympy==1.13.1
184
+ tensorboard==2.18.0
185
+ tensorboard-data-server==0.7.2
186
+ termcolor==2.5.0
187
+ thinc==8.2.5
188
+ threadpoolctl==3.5.0
189
+ tokenizers==0.20.3
190
+ tomlkit==0.12.0
191
+ torch==2.5.1
192
+ torch-stoi==0.2.3
193
+ torchaudio==2.5.1
194
+ tqdm==4.66.6
195
+ trainer==0.0.36
196
+ traitlets==5.14.3
197
+ transformers==4.46.3
198
+ TTS==0.22.0
199
+ typeguard==4.4.1
200
+ typer==0.12.5
201
+ typing_extensions==4.12.2
202
+ tzdata==2024.2
203
+ tzlocal==5.2
204
+ umap-learn==0.5.7
205
+ Unidecode==1.3.8
206
+ uritemplate==4.1.1
207
+ urllib3==2.2.3
208
+ uvicorn==0.32.0
209
+ wasabi==1.1.3
210
+ wcwidth==0.2.13
211
+ weasel==0.4.1
212
+ websockets==12.0
213
+ Werkzeug==3.1.3
214
+ wrapt==1.17.0
215
+ yarl==1.18.0
216
+ zipp==3.20.2