Spaces:
Runtime error
Runtime error
update
Browse files
inference/tts/gradio/infer.py
CHANGED
|
@@ -10,6 +10,8 @@ from utils.commons.hparams import set_hparams
|
|
| 10 |
from utils.commons.hparams import hparams as hp
|
| 11 |
import numpy as np
|
| 12 |
|
|
|
|
|
|
|
| 13 |
|
| 14 |
class GradioInfer:
|
| 15 |
def __init__(self, exp_name, inference_cls, title, description, article, example_inputs):
|
|
@@ -23,7 +25,9 @@ class GradioInfer:
|
|
| 23 |
self.inference_cls = getattr(importlib.import_module(pkg), cls_name)
|
| 24 |
|
| 25 |
def greet(self, text):
|
| 26 |
-
sents = re.split(
|
|
|
|
|
|
|
| 27 |
audio_outs = []
|
| 28 |
s = ""
|
| 29 |
for i in range(0, len(sents), 2):
|
|
|
|
| 10 |
from utils.commons.hparams import hparams as hp
|
| 11 |
import numpy as np
|
| 12 |
|
| 13 |
+
from utils.text.text_encoder import PUNCS
|
| 14 |
+
|
| 15 |
|
| 16 |
class GradioInfer:
|
| 17 |
def __init__(self, exp_name, inference_cls, title, description, article, example_inputs):
|
|
|
|
| 25 |
self.inference_cls = getattr(importlib.import_module(pkg), cls_name)
|
| 26 |
|
| 27 |
def greet(self, text):
|
| 28 |
+
sents = re.split(rf'([{PUNCS}])', text.replace('\n', ','))
|
| 29 |
+
if sents[-1] not in list(PUNCS):
|
| 30 |
+
sents = sents + ['.']
|
| 31 |
audio_outs = []
|
| 32 |
s = ""
|
| 33 |
for i in range(0, len(sents), 2):
|