Martijn Bartelds
commited on
Commit
•
dae4c4e
1
Parent(s):
2e66007
Initial commit
Browse files- README.md +6 -4
- app.py +46 -0
- packages.txt +2 -0
- requirements.txt +4 -0
README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
---
|
2 |
title: GROTTS
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
-
sdk_version:
|
8 |
app_file: app.py
|
9 |
pinned: false
|
|
|
|
|
10 |
---
|
11 |
|
12 |
-
|
|
|
1 |
---
|
2 |
title: GROTTS
|
3 |
+
emoji: 🏢
|
4 |
+
colorFrom: gray
|
5 |
colorTo: red
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 2.9.1
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
+
models:
|
11 |
+
- bartelds/grotts_vits
|
12 |
---
|
13 |
|
14 |
+
Gronings TTS system (VITS) for three variants: Hoogelaandsters, Oldambsters, and Westerkwartiers.
|
app.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import time
|
3 |
+
import urllib.request
|
4 |
+
from pathlib import Path
|
5 |
+
import os
|
6 |
+
import torch
|
7 |
+
import scipy.io.wavfile
|
8 |
+
from espnet2.bin.tts_inference import Text2Speech
|
9 |
+
from espnet2.utils.types import str_or_none
|
10 |
+
|
11 |
+
|
12 |
+
gos_text2speech = Text2Speech.from_pretrained(
|
13 |
+
model_tag="bartelds/grotts_vits",
|
14 |
+
vocoder_tag="none",
|
15 |
+
device="cpu",
|
16 |
+
speed_control_alpha=1.0,
|
17 |
+
noise_scale=1.0,
|
18 |
+
noise_scale_dur=1.0
|
19 |
+
)
|
20 |
+
|
21 |
+
def inference(text,lang):
|
22 |
+
with torch.no_grad():
|
23 |
+
if lang == "Hoogelaandsters":
|
24 |
+
wav = gos_text2speech(text, sids=np.array([1]))["wav"]
|
25 |
+
scipy.io.wavfile.write("out.wav", gos_text2speech.fs , wav.view(-1).cpu().numpy())
|
26 |
+
if lang == "Oldambsters":
|
27 |
+
wav = gos_text2speech(text, sids=np.array([2]))["wav"]
|
28 |
+
scipy.io.wavfile.write("out.wav", nld_text2speech.fs , wav.view(-1).cpu().numpy())
|
29 |
+
if lang == "Westerkwartiers":
|
30 |
+
wav = gos_text2speech(text, sids=np.array([3]))["wav"]
|
31 |
+
scipy.io.wavfile.write("out.wav", eng_text2speech.fs , wav.view(-1).cpu().numpy())
|
32 |
+
|
33 |
+
return "out.wav", "out.wav"
|
34 |
+
|
35 |
+
title = "GroTTS"
|
36 |
+
examples = [
|
37 |
+
['Ze gingen mit klas noar waddendiek, over en deur bragel lopen.', 'Hoogelaandsters']
|
38 |
+
]
|
39 |
+
|
40 |
+
gr.Interface(
|
41 |
+
inference,
|
42 |
+
[gr.inputs.Textbox(label="input text", lines=3), gr.inputs.Radio(choices=["Hoogelaandsters", "Oldambsters", "Westerkertaaiers"], type="value", default="Hoogelaandsters", label="language")],
|
43 |
+
[gr.outputs.Audio(type="file", label="Output"), gr.outputs.File()],
|
44 |
+
title=title,
|
45 |
+
examples=examples
|
46 |
+
).launch(enable_queue=True)
|
packages.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
cmake
|
2 |
+
libsndfile1
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
espnet
|
2 |
+
espnet_model_zoo
|
3 |
+
scipy
|
4 |
+
torch
|