Spaces:
Build error
Build error
Commit
·
576bebe
1
Parent(s):
7f71b9c
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,19 @@ gos_text2speech = Text2Speech.from_pretrained(
|
|
21 |
vocoder_tag="parallel_wavegan/ljspeech_parallel_wavegan.v3"
|
22 |
)
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
def inference(text,lang):
|
25 |
with torch.no_grad():
|
26 |
if lang == "gronings":
|
27 |
wav = gos_text2speech(text)["wav"]
|
28 |
scipy.io.wavfile.write("out.wav", gos_text2speech.fs , wav.view(-1).cpu().numpy())
|
|
|
|
|
|
|
29 |
|
30 |
return "out.wav", "out.wav"
|
31 |
|
@@ -37,7 +45,7 @@ examples = [
|
|
37 |
|
38 |
gr.Interface(
|
39 |
inference,
|
40 |
-
[gr.inputs.Textbox(label="input text", lines=3), gr.inputs.Radio(choices=["gronings"], type="value", default="gronings", label="language")],
|
41 |
[gr.outputs.Audio(type="file", label="Output"), gr.outputs.File()],
|
42 |
title=title,
|
43 |
examples=examples
|
|
|
21 |
vocoder_tag="parallel_wavegan/ljspeech_parallel_wavegan.v3"
|
22 |
)
|
23 |
|
24 |
+
westerkwartiers_text2speech = Text2Speech.from_pretrained(
|
25 |
+
model_tag="https://huggingface.co/ahnafsamin/FastSpeech2-gronings-westerkwartiers/resolve/main/tts_train_fastspeech2_raw_char_tacotron_train.loss.ave.zip",
|
26 |
+
vocoder_tag="parallel_wavegan/ljspeech_parallel_wavegan.v3"
|
27 |
+
)
|
28 |
+
|
29 |
def inference(text,lang):
|
30 |
with torch.no_grad():
|
31 |
if lang == "gronings":
|
32 |
wav = gos_text2speech(text)["wav"]
|
33 |
scipy.io.wavfile.write("out.wav", gos_text2speech.fs , wav.view(-1).cpu().numpy())
|
34 |
+
elif lang == "gronings westerkwartiers":
|
35 |
+
wav = westerkwartiers_text2speech(text)["wav"]
|
36 |
+
scipy.io.wavfile.write("out.wav", westerkwartiers_text2speech.fs , wav.view(-1).cpu().numpy())
|
37 |
|
38 |
return "out.wav", "out.wav"
|
39 |
|
|
|
45 |
|
46 |
gr.Interface(
|
47 |
inference,
|
48 |
+
[gr.inputs.Textbox(label="input text", lines=3), gr.inputs.Radio(choices=["gronings", "gronings westerkwartiers"], type="value", default="gronings", label="language")],
|
49 |
[gr.outputs.Audio(type="file", label="Output"), gr.outputs.File()],
|
50 |
title=title,
|
51 |
examples=examples
|