ihanif commited on
Commit
8ed9d92
1 Parent(s): e1470c7

Use Dutch language model for TSS

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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
- processor = SpeechT5Processor.from_pretrained("ihanif/speecht5_finetuned_voxpopuli_lt")
 
 
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("ihanif/speecht5_finetuned_voxpopuli_lt").to(device)
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": "lt"})
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