Update handler.py
Browse files- handler.py +4 -4
handler.py
CHANGED
@@ -20,7 +20,7 @@ else:
|
|
20 |
class EndpointHandler():
|
21 |
def __init__(self, path=""):
|
22 |
# Load all required models
|
23 |
-
self.model_id = "Oysiyl/
|
24 |
self.spk_model_name = "speechbrain/spkrec-xvect-voxceleb"
|
25 |
self.model = SpeechT5ForTextToSpeech.from_pretrained(self.model_id, torch_dtype=dtype).to(device)
|
26 |
self.processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
@@ -36,12 +36,12 @@ class EndpointHandler():
|
|
36 |
|
37 |
@staticmethod
|
38 |
def remove_special_characters_s(text: Text) -> Text:
|
39 |
-
chars_to_remove_regex = '[
|
40 |
# remove special characters
|
41 |
text = re.sub(chars_to_remove_regex, '', text)
|
42 |
-
text = re.sub("
|
43 |
text = re.sub("’", "'", text)
|
44 |
-
text = re.sub(
|
45 |
text = text.lower()
|
46 |
return text
|
47 |
|
|
|
20 |
class EndpointHandler():
|
21 |
def __init__(self, path=""):
|
22 |
# Load all required models
|
23 |
+
self.model_id = "Oysiyl/speecht5_tts_common_voice_uk"
|
24 |
self.spk_model_name = "speechbrain/spkrec-xvect-voxceleb"
|
25 |
self.model = SpeechT5ForTextToSpeech.from_pretrained(self.model_id, torch_dtype=dtype).to(device)
|
26 |
self.processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
|
|
36 |
|
37 |
@staticmethod
|
38 |
def remove_special_characters_s(text: Text) -> Text:
|
39 |
+
chars_to_remove_regex = '[\-\…\–\"\“\%\‘\”\�\»\«\„\`\'́]'
|
40 |
# remove special characters
|
41 |
text = re.sub(chars_to_remove_regex, '', text)
|
42 |
+
text = re.sub("՚", "'", text)
|
43 |
text = re.sub("’", "'", text)
|
44 |
+
text = re.sub(r'ы', 'и', text)
|
45 |
text = text.lower()
|
46 |
return text
|
47 |
|