juliuserictuliao commited on
Commit
ff18df9
1 Parent(s): af6c335

change to italian

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -11,15 +11,15 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
11
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
12
 
13
  # Load text-to-speech checkpoint and speaker embeddings
14
- processor = SpeechT5Processor.from_pretrained("facebook/mms-tts-spa")
15
- model = SpeechT5ForTextToSpeech.from_pretrained("facebook/mms-tts-spa").to(device)
16
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
17
 
18
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
19
  speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0).to(device)
20
 
21
  def translate(audio):
22
- outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "es"})
23
  return outputs["text"]
24
 
25
  def synthesise(text):
 
11
  asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
12
 
13
  # Load text-to-speech checkpoint and speaker embeddings
14
+ processor = SpeechT5Processor.from_pretrained("juliuserictuliao/speecht5_finetuned_voxpopuli_it")
15
+ model = SpeechT5ForTextToSpeech.from_pretrained("juliuserictuliao/speecht5_finetuned_voxpopuli_it").to(device)
16
  vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan").to(device)
17
 
18
  embeddings_dataset = load_dataset("Matthijs/cmu-arctic-xvectors", split="validation")
19
  speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze(0).to(device)
20
 
21
  def translate(audio):
22
+ outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "it"})
23
  return outputs["text"]
24
 
25
  def synthesise(text):