Spaces:
Sleeping
Sleeping
Use Dutch language model for TSS
Browse files
app.py
CHANGED
@@ -13,11 +13,13 @@ asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base",
|
|
13 |
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
16 |
-
|
|
|
|
|
17 |
|
18 |
#model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts").to(device)
|
19 |
#vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
20 |
-
model = SpeechT5ForTextToSpeech.from_pretrained(
|
21 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
22 |
|
23 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
@@ -25,7 +27,7 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze
|
|
25 |
|
26 |
|
27 |
def translate(audio):
|
28 |
-
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate", "language": "
|
29 |
return outputs["text"]
|
30 |
|
31 |
|
|
|
13 |
|
14 |
# load text-to-speech checkpoint and speaker embeddings
|
15 |
#processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
|
16 |
+
#"ihanif/speecht5_finetuned_voxpopuli_lt"
|
17 |
+
model_id = "sanchit-gandhi/speecht5_tts_vox_nl"
|
18 |
+
processor = SpeechT5Processor.from_pretrained(model_id)
|
19 |
|
20 |
#model = SpeechT5ForTextToSpeech.from_pretrained("microsoft/speecht5_tts").to(device)
|
21 |
#vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
22 |
+
model = SpeechT5ForTextToSpeech.from_pretrained(model_id).to(device)
|
23 |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
|
24 |
|
25 |
embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
|
|
|
27 |
|
28 |
|
29 |
def translate(audio):
|
30 |
+
outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate", "language": "nl"})
|
31 |
return outputs["text"]
|
32 |
|
33 |
|