Spaces:
Runtime error
Runtime error
Justin
commited on
Commit
•
10e4dd0
1
Parent(s):
0ed9306
dexotify, use code however you like
Browse filesDidn't text this implementation exactly, and know that you all require the rights release for any contributions. I share any copyrights with Coqui if you use the code. Understand if you don't use it or chose to re-implement it another way. It seems to be a quite capable method, for the small amount of use I see on the voices space I see a few rejections each day that seem appropriate.
app.py
CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
|
|
5 |
import numpy as np
|
6 |
from TTS.utils.manage import ModelManager
|
7 |
from TTS.utils.synthesizer import Synthesizer
|
|
|
8 |
|
9 |
|
10 |
MODELS = {}
|
@@ -33,6 +34,19 @@ def tts(text: str, model_name: str):
|
|
33 |
text = text[:MAX_TXT_LEN]
|
34 |
print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
|
35 |
print(text, model_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
# download model
|
37 |
model_path, config_path, model_item = manager.download_model(model_name)
|
38 |
vocoder_name: Optional[str] = model_item["default_vocoder"]
|
|
|
5 |
import numpy as np
|
6 |
from TTS.utils.manage import ModelManager
|
7 |
from TTS.utils.synthesizer import Synthesizer
|
8 |
+
from detoxify import Detoxify
|
9 |
|
10 |
|
11 |
MODELS = {}
|
|
|
34 |
text = text[:MAX_TXT_LEN]
|
35 |
print(f"Input text was cutoff since it went over the {MAX_TXT_LEN} character limit.")
|
36 |
print(text, model_name)
|
37 |
+
# detoxify
|
38 |
+
thresholds = {
|
39 |
+
'toxicity': 0.4,
|
40 |
+
'severe_toxicity': 0.2,
|
41 |
+
'obscene': 0.3,
|
42 |
+
'threat': 0.3,
|
43 |
+
'insult': 0.3,
|
44 |
+
'identity_attack': 0.3
|
45 |
+
}
|
46 |
+
|
47 |
+
results = Detoxify('original').predict(text)
|
48 |
+
#results = Detoxify('multilingual').predict(text)
|
49 |
+
|
50 |
# download model
|
51 |
model_path, config_path, model_item = manager.download_model(model_name)
|
52 |
vocoder_name: Optional[str] = model_item["default_vocoder"]
|