Add back the spaces

This commit is contained in:
oobabooga
2023-04-06 20:45:41 -03:00
parent 7e31bc485c
commit 773e1246da
3 changed files with 20 additions and 0 deletions

View File

@@ -5,8 +5,10 @@ import torch
import tts_preprocessor
torch._C._jit_set_profiling_mode(False)
params = {
'activate': True,
'speaker': 'en_49',
@@ -34,15 +36,18 @@ table = str.maketrans({
'"': """,
})
def xmlesc(txt):
return txt.translate(table)
def load_model():
model, example_text = torch.hub.load(repo_or_dir='snakers4/silero-models', model='silero_tts', language=params['language'], speaker=params['model_id'])
model.to(params['device'])
return model
model = load_model()
def output_modifier(string):
"""
This function is applied to the model outputs.
@@ -70,6 +75,7 @@ def output_modifier(string):
print(string)
if __name__ == '__main__':
import sys
output_modifier(sys.argv[1])