Spaces:
Runtime error
Runtime error
Eren Gรถlge
commited on
Commit
โข
a3635dc
1
Parent(s):
8f9ad5e
Update UI
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ MODEL_NAMES = EN + OTHER
|
|
28 |
print(MODEL_NAMES)
|
29 |
|
30 |
|
31 |
-
def tts(text: str, model_name: str
|
32 |
if len(text) > MAX_TXT_LEN:
|
33 |
text = text[:MAX_TXT_LEN]
|
34 |
print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
|
@@ -48,72 +48,124 @@ def tts(text: str, model_name: str, speaker_idx: str=None):
|
|
48 |
# synthesize
|
49 |
if synthesizer is None:
|
50 |
raise NameError("model not found")
|
51 |
-
wavs = synthesizer.tts(text,
|
52 |
# return output
|
53 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
54 |
synthesizer.save_wav(wavs, fp)
|
55 |
return fp.name
|
56 |
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
```bash
|
67 |
-
$ pip install TTS
|
68 |
-
...
|
69 |
-
$ tts --list_models
|
70 |
-
...
|
71 |
-
$ tts --text "Text for TTS" --model_name "<type>/<language>/<dataset>/<model_name>" --out_path folder/to/save/output.wav
|
72 |
-
```
|
73 |
-
<img src="https://static.scarf.sh/a.png?x-pxid=1404a024-e647-4406-bb9a-4ade0c931182" />
|
74 |
-
<br/>
|
75 |
-
|
76 |
-
๐ <b> Model contributors</b>
|
77 |
-
|
78 |
-
- <a href="https://github.com/nmstoker/" target="_blank">@nmstoker</a>
|
79 |
-
- <a href="https://github.com/kaiidams/" target="_blank">@kaiidams</a>
|
80 |
-
- <a href="https://github.com/WeberJulian/" target="_blank">@WeberJulian,</a>
|
81 |
-
- <a href="https://github.com/Edresson/" target="_blank">@Edresson</a>
|
82 |
-
- <a href="https://github.com/thorstenMueller/" target="_blank">@thorstenMueller</a>
|
83 |
-
- <a href="https://github.com/r-dh/" target="_blank">@r-dh</a>
|
84 |
-
- <a href="https://github.com/kirianguiller/" target="_blank">@kirianguiller</a>
|
85 |
-
- <a href="https://github.com/robinhad/" target="_blank">@robinhad</a>
|
86 |
-
- <a href="https://github.com/fkarabiber/" target="_blank">@fkarabiber</a>
|
87 |
-
- <a href="https://github.com/nicolalandro/" target="_blank">@nicolalandro</a>
|
88 |
-
- <a href="https://github.com/a-froghyar" target="_blank">@a-froghyar</a>
|
89 |
-
- <a href="https://github.com/manmay-nakhashi" target="_blank">@manmay-nakhashi</a>
|
90 |
-
- <a href="https://github.com/noml4u" target="_blank">@noml4u</a>
|
91 |
-
|
92 |
-
๐ Drop a โจPRโจ on ๐ธTTS to share a new model and have it included here.
|
93 |
"""
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
)
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
print(MODEL_NAMES)
|
29 |
|
30 |
|
31 |
+
def tts(text: str, model_name: str):
|
32 |
if len(text) > MAX_TXT_LEN:
|
33 |
text = text[:MAX_TXT_LEN]
|
34 |
print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
|
|
|
48 |
# synthesize
|
49 |
if synthesizer is None:
|
50 |
raise NameError("model not found")
|
51 |
+
wavs = synthesizer.tts(text, None)
|
52 |
# return output
|
53 |
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
|
54 |
synthesizer.save_wav(wavs, fp)
|
55 |
return fp.name
|
56 |
|
57 |
|
58 |
+
title = """<h1 align="center">๐ธ๐ฌ CoquiTTS Playground </h1>"""
|
59 |
+
custom_css = """
|
60 |
+
#banner-image {
|
61 |
+
display: block;
|
62 |
+
margin-left: auto;
|
63 |
+
margin-right: auto;
|
64 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
"""
|
66 |
|
67 |
+
with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
|
68 |
+
with gr.Row():
|
69 |
+
with gr.Column():
|
70 |
+
# gr.Image("https://raw.githubusercontent.com/coqui-ai/TTS/main/images/coqui-log-green-TTS.png", elem_id="banner-image", show_label=False)
|
71 |
+
gr.Markdown(
|
72 |
+
"""
|
73 |
+
## <img src="https://raw.githubusercontent.com/coqui-ai/TTS/main/images/coqui-log-green-TTS.png" height="56"/>
|
74 |
+
"""
|
75 |
+
)
|
76 |
+
gr.Markdown(
|
77 |
+
"""
|
78 |
+
<br />
|
79 |
+
|
80 |
+
## ๐ธCoqui.ai News
|
81 |
+
- ๐ฃ ๐ธTTS now supports ๐ขTortoise with faster inference.
|
82 |
+
- ๐ฃ **Coqui Studio API** is landed on ๐ธTTS. - [Example](https://github.com/coqui-ai/TTS/blob/dev/README.md#-python-api)
|
83 |
+
- ๐ฃ [**Coqui Sudio API**](https://docs.coqui.ai/docs) is live.
|
84 |
+
- ๐ฃ Voice generation with prompts - **Prompt to Voice** - is live on [**Coqui Studio**](https://app.coqui.ai/auth/signin)!! - [Blog Post](https://coqui.ai/blog/tts/prompt-to-voice)
|
85 |
+
- ๐ฃ Voice generation with fusion - **Voice fusion** - is live on [**Coqui Studio**](https://app.coqui.ai/auth/signin).
|
86 |
+
- ๐ฃ Voice cloning is live on [**Coqui Studio**](https://app.coqui.ai/auth/signin).
|
87 |
+
<br>
|
88 |
+
|
89 |
+
"""
|
90 |
+
)
|
91 |
+
with gr.Column():
|
92 |
+
gr.Markdown(
|
93 |
+
"""
|
94 |
+
<br/>
|
95 |
+
|
96 |
+
๐ป This space showcases some of the **[CoquiTTS](https://github.com/coqui-ai/TTS)** models.
|
97 |
+
|
98 |
+
<br/>
|
99 |
+
|
100 |
+
There are > 30 languages with single and multi speaker models, all thanks to our ๐ Contributors.
|
101 |
+
|
102 |
+
<br/>
|
103 |
+
|
104 |
+
Visit the links below for more.
|
105 |
+
|
106 |
+
| | |
|
107 |
+
| ------------------------------- | --------------------------------------- |
|
108 |
+
| ๐ธ๐ฌ **CoquiTTS** | [Github](https://github.com/coqui-ai/TTS) |
|
109 |
+
| ๐ผ **Documentation** | [ReadTheDocs](https://tts.readthedocs.io/en/latest/)
|
110 |
+
| ๐ฉโ๐ป **Questions** | [GitHub Discussions] |
|
111 |
+
| ๐ฏ **Community** | [![Dicord](https://img.shields.io/discord/1037326658807533628?color=%239B59B6&label=chat%20on%20discord)](https://discord.gg/5eXr5seRrv) |
|
112 |
+
|
113 |
+
[github issue tracker]: https://github.com/coqui-ai/tts/issues
|
114 |
+
[github discussions]: https://github.com/coqui-ai/TTS/discussions
|
115 |
+
[discord]: https://discord.gg/5eXr5seRrv
|
116 |
+
|
117 |
+
|
118 |
+
"""
|
119 |
+
)
|
120 |
+
|
121 |
+
with gr.Row():
|
122 |
+
gr.Markdown(
|
123 |
+
"""
|
124 |
+
<details>
|
125 |
+
<summary>๐ Model contributors</summary>
|
126 |
+
|
127 |
+
- <a href="https://github.com/nmstoker/" target="_blank">@nmstoker</a>
|
128 |
+
- <a href="https://github.com/kaiidams/" target="_blank">@kaiidams</a>
|
129 |
+
- <a href="https://github.com/WeberJulian/" target="_blank">@WeberJulian,</a>
|
130 |
+
- <a href="https://github.com/Edresson/" target="_blank">@Edresson</a>
|
131 |
+
- <a href="https://github.com/thorstenMueller/" target="_blank">@thorstenMueller</a>
|
132 |
+
- <a href="https://github.com/r-dh/" target="_blank">@r-dh</a>
|
133 |
+
- <a href="https://github.com/kirianguiller/" target="_blank">@kirianguiller</a>
|
134 |
+
- <a href="https://github.com/robinhad/" target="_blank">@robinhad</a>
|
135 |
+
- <a href="https://github.com/fkarabiber/" target="_blank">@fkarabiber</a>
|
136 |
+
- <a href="https://github.com/nicolalandro/" target="_blank">@nicolalandro</a>
|
137 |
+
- <a href="https://github.com/a-froghyar" target="_blank">@a-froghyar</a>
|
138 |
+
- <a href="https://github.com/manmay-nakhashi" target="_blank">@manmay-nakhashi</a>
|
139 |
+
- <a href="https://github.com/noml4u" target="_blank">@noml4u</a>
|
140 |
+
</details>
|
141 |
+
|
142 |
+
<br/>
|
143 |
+
"""
|
144 |
+
)
|
145 |
+
|
146 |
+
with gr.Row():
|
147 |
+
with gr.Column():
|
148 |
+
input_text = gr.inputs.Textbox(
|
149 |
+
label="Input Text",
|
150 |
+
default="This sentence has been generated by a speech synthesis system.",
|
151 |
+
)
|
152 |
+
model_select = gr.inputs.Dropdown(
|
153 |
+
label="Pick Model: tts_models/<language>/<dataset>/<model_name>",
|
154 |
+
choices=MODEL_NAMES,
|
155 |
+
default="tts_models/en/jenny/jenny"
|
156 |
+
)
|
157 |
+
tts_button = gr.Button("Send", elem_id="send-btn", visible=True)
|
158 |
+
|
159 |
+
with gr.Column():
|
160 |
+
output_audio = gr.outputs.Audio(label="Output", type="filepath")
|
161 |
+
|
162 |
+
tts_button.click(
|
163 |
+
tts,
|
164 |
+
inputs=[
|
165 |
+
input_text,
|
166 |
+
model_select,
|
167 |
+
],
|
168 |
+
outputs=[output_audio],
|
169 |
+
)
|
170 |
+
|
171 |
+
demo.queue(concurrency_count=16).launch(debug=True)
|