Spaces:
Build error
Build error
Commit
·
e886026
1
Parent(s):
973d1b5
Update app.py
Browse filesfix languages, runtime error assertion
app.py
CHANGED
|
@@ -1,7 +1,5 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
-
#os.system("pip uninstall -y gradio")
|
| 4 |
-
#os.system("pip install --upgrade gradio==3.24.0")
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
from TTS.api import TTS
|
|
@@ -38,15 +36,12 @@ def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree):
|
|
| 38 |
speaker_wav=speaker_wav,
|
| 39 |
language=language,
|
| 40 |
)
|
| 41 |
-
except RuntimeError
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
sys.exit("Exit due to cuda device-assert")
|
| 48 |
-
raise
|
| 49 |
-
|
| 50 |
return (
|
| 51 |
gr.make_waveform(
|
| 52 |
audio="output.wav",
|
|
@@ -66,10 +61,11 @@ title = "Coqui🐸 XTTS"
|
|
| 66 |
description = """
|
| 67 |
<a href="https://huggingface.co/coqui/XTTS-v1">XTTS</a> is a Voice generation model that lets you clone voices into different languages by using just a quick 3-second audio clip.
|
| 68 |
<br/>
|
| 69 |
-
|
| 70 |
<br/>
|
| 71 |
-
This is the same model that powers Coqui Studio
|
| 72 |
<br/>
|
|
|
|
| 73 |
<br/>
|
| 74 |
<p>For faster inference without waiting in the queue, you should duplicate this space and upgrade to GPU via the settings.
|
| 75 |
<br/>
|
|
@@ -83,7 +79,6 @@ article = """
|
|
| 83 |
<p>By using this demo you agree to the terms of the Coqui Public Model License at https://coqui.ai/cpml</p>
|
| 84 |
</div>
|
| 85 |
"""
|
| 86 |
-
|
| 87 |
examples = [
|
| 88 |
[
|
| 89 |
"Once when I was six years old I saw a magnificent picture",
|
|
@@ -101,6 +96,38 @@ examples = [
|
|
| 101 |
False,
|
| 102 |
True,
|
| 103 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
[
|
| 105 |
"Un tempo lontano, quando avevo sei anni, vidi un magnifico disegno",
|
| 106 |
"it",
|
|
@@ -117,8 +144,42 @@ examples = [
|
|
| 117 |
False,
|
| 118 |
True,
|
| 119 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
]
|
| 121 |
|
|
|
|
|
|
|
| 122 |
gr.Interface(
|
| 123 |
fn=predict,
|
| 124 |
inputs=[
|
|
@@ -141,7 +202,7 @@ gr.Interface(
|
|
| 141 |
"tr",
|
| 142 |
"ru",
|
| 143 |
"nl",
|
| 144 |
-
"
|
| 145 |
"ar",
|
| 146 |
"zh-cn",
|
| 147 |
],
|
|
@@ -173,4 +234,4 @@ gr.Interface(
|
|
| 173 |
description=description,
|
| 174 |
article=article,
|
| 175 |
examples=examples,
|
| 176 |
-
).queue().launch(debug=True)
|
|
|
|
| 1 |
import sys
|
| 2 |
import os
|
|
|
|
|
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
from TTS.api import TTS
|
|
|
|
| 36 |
speaker_wav=speaker_wav,
|
| 37 |
language=language,
|
| 38 |
)
|
| 39 |
+
except RuntimeError :
|
| 40 |
+
# cannot do anything on cuda device side error, need tor estart
|
| 41 |
+
gr.Warning("Unhandled Exception encounter, please retry in a minute")
|
| 42 |
+
print("Cuda device-assert Runtime encountered need restart")
|
| 43 |
+
sys.exit("Exit due to cuda device-assert")
|
| 44 |
+
|
|
|
|
|
|
|
|
|
|
| 45 |
return (
|
| 46 |
gr.make_waveform(
|
| 47 |
audio="output.wav",
|
|
|
|
| 61 |
description = """
|
| 62 |
<a href="https://huggingface.co/coqui/XTTS-v1">XTTS</a> is a Voice generation model that lets you clone voices into different languages by using just a quick 3-second audio clip.
|
| 63 |
<br/>
|
| 64 |
+
XTTS is built on previous research, like Tortoise, with additional architectural innovations and training to make cross-language voice cloning and multilingual speech generation possible.
|
| 65 |
<br/>
|
| 66 |
+
This is the same model that powers our creator application <a href="https://coqui.ai">Coqui Studio</a> as well as the <a href="https://docs.coqui.ai">Coqui API</a>. In production we apply modifications to make low-latency streaming possible.
|
| 67 |
<br/>
|
| 68 |
+
Leave a star on the Github <a href="https://github.com/coqui-ai/TTS">🐸TTS</a>, where our open-source inference and training code lives.
|
| 69 |
<br/>
|
| 70 |
<p>For faster inference without waiting in the queue, you should duplicate this space and upgrade to GPU via the settings.
|
| 71 |
<br/>
|
|
|
|
| 79 |
<p>By using this demo you agree to the terms of the Coqui Public Model License at https://coqui.ai/cpml</p>
|
| 80 |
</div>
|
| 81 |
"""
|
|
|
|
| 82 |
examples = [
|
| 83 |
[
|
| 84 |
"Once when I was six years old I saw a magnificent picture",
|
|
|
|
| 96 |
False,
|
| 97 |
True,
|
| 98 |
],
|
| 99 |
+
[
|
| 100 |
+
"Als ich sechs war, sah ich einmal ein wunderbares Bild",
|
| 101 |
+
"de",
|
| 102 |
+
"examples/female.wav",
|
| 103 |
+
None,
|
| 104 |
+
False,
|
| 105 |
+
True,
|
| 106 |
+
],
|
| 107 |
+
[
|
| 108 |
+
"Cuando tenía seis años, vi una vez una imagen magnífica",
|
| 109 |
+
"es",
|
| 110 |
+
"examples/male.wav",
|
| 111 |
+
None,
|
| 112 |
+
False,
|
| 113 |
+
True,
|
| 114 |
+
],
|
| 115 |
+
[
|
| 116 |
+
"Quando eu tinha seis anos eu vi, uma vez, uma imagem magnífica",
|
| 117 |
+
"pt",
|
| 118 |
+
"examples/female.wav",
|
| 119 |
+
None,
|
| 120 |
+
False,
|
| 121 |
+
True,
|
| 122 |
+
],
|
| 123 |
+
[
|
| 124 |
+
"Kiedy miałem sześć lat, zobaczyłem pewnego razu wspaniały obrazek",
|
| 125 |
+
"pl",
|
| 126 |
+
"examples/male.wav",
|
| 127 |
+
None,
|
| 128 |
+
False,
|
| 129 |
+
True,
|
| 130 |
+
],
|
| 131 |
[
|
| 132 |
"Un tempo lontano, quando avevo sei anni, vidi un magnifico disegno",
|
| 133 |
"it",
|
|
|
|
| 144 |
False,
|
| 145 |
True,
|
| 146 |
],
|
| 147 |
+
[
|
| 148 |
+
"Когда мне было шесть лет, я увидел однажды удивительную картинку",
|
| 149 |
+
"ru",
|
| 150 |
+
"examples/female.wav",
|
| 151 |
+
None,
|
| 152 |
+
False,
|
| 153 |
+
True,
|
| 154 |
+
],
|
| 155 |
+
[
|
| 156 |
+
"Toen ik een jaar of zes was, zag ik op een keer een prachtige plaat",
|
| 157 |
+
"nl",
|
| 158 |
+
"examples/male.wav",
|
| 159 |
+
None,
|
| 160 |
+
False,
|
| 161 |
+
True,
|
| 162 |
+
],
|
| 163 |
+
[
|
| 164 |
+
"Když mi bylo šest let, viděl jsem jednou nádherný obrázek",
|
| 165 |
+
"cs",
|
| 166 |
+
"examples/female.wav",
|
| 167 |
+
None,
|
| 168 |
+
False,
|
| 169 |
+
True,
|
| 170 |
+
],
|
| 171 |
+
[
|
| 172 |
+
"当我还只有六岁的时候, 看到了一副精彩的插画",
|
| 173 |
+
"zh-cn",
|
| 174 |
+
"examples/female.wav",
|
| 175 |
+
None,
|
| 176 |
+
False,
|
| 177 |
+
True,
|
| 178 |
+
],
|
| 179 |
]
|
| 180 |
|
| 181 |
+
|
| 182 |
+
|
| 183 |
gr.Interface(
|
| 184 |
fn=predict,
|
| 185 |
inputs=[
|
|
|
|
| 202 |
"tr",
|
| 203 |
"ru",
|
| 204 |
"nl",
|
| 205 |
+
"cs",
|
| 206 |
"ar",
|
| 207 |
"zh-cn",
|
| 208 |
],
|
|
|
|
| 234 |
description=description,
|
| 235 |
article=article,
|
| 236 |
examples=examples,
|
| 237 |
+
).queue().launch(debug=True)
|