Martijn Bartelds
commited on
Commit
•
c3ebb96
1
Parent(s):
1204cff
Update app
Browse files
app.py
CHANGED
@@ -3,11 +3,15 @@ import time
|
|
3 |
import torch
|
4 |
import urllib.request
|
5 |
import gradio as gr
|
|
|
6 |
import numpy as np
|
7 |
import soundfile as sf
|
8 |
from espnet2.bin.tts_inference import Text2Speech
|
9 |
from espnet2.utils.types import str_or_none
|
10 |
from pathlib import Path
|
|
|
|
|
|
|
11 |
|
12 |
gos_text2speech = Text2Speech.from_pretrained(
|
13 |
model_tag="bartelds/gos_tts",
|
@@ -19,7 +23,7 @@ gos_text2speech = Text2Speech.from_pretrained(
|
|
19 |
|
20 |
def inference(text, lang):
|
21 |
with torch.no_grad():
|
22 |
-
lines = text.
|
23 |
outputs = []
|
24 |
|
25 |
for line in lines:
|
|
|
3 |
import torch
|
4 |
import urllib.request
|
5 |
import gradio as gr
|
6 |
+
import nltk
|
7 |
import numpy as np
|
8 |
import soundfile as sf
|
9 |
from espnet2.bin.tts_inference import Text2Speech
|
10 |
from espnet2.utils.types import str_or_none
|
11 |
from pathlib import Path
|
12 |
+
from nltk.tokenize import sent_tokenize
|
13 |
+
|
14 |
+
nltk.download('punkt')
|
15 |
|
16 |
gos_text2speech = Text2Speech.from_pretrained(
|
17 |
model_tag="bartelds/gos_tts",
|
|
|
23 |
|
24 |
def inference(text, lang):
|
25 |
with torch.no_grad():
|
26 |
+
lines = sent_tokenize(text.lower())
|
27 |
outputs = []
|
28 |
|
29 |
for line in lines:
|