voxxer commited on
Commit
bc4130b
·
1 Parent(s): 99aac62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -10,7 +10,7 @@ from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Proce
10
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
11
 
12
  # load speech translation checkpoint
13
- asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
14
 
15
  # load text-to-speech checkpoint and speaker embeddings
16
  processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
@@ -23,7 +23,7 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze
23
 
24
 
25
  def translate(audio):
26
- outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "translate", "language": "ru"})
27
  return outputs["text"]
28
 
29
 
 
10
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
11
 
12
  # load speech translation checkpoint
13
+ asr_pipe = pipeline("automatic-speech-recognition", model="openai/whisper-medium", device=device)
14
 
15
  # load text-to-speech checkpoint and speaker embeddings
16
  processor = SpeechT5Processor.from_pretrained("microsoft/speecht5_tts")
 
23
 
24
 
25
  def translate(audio):
26
+ outputs = asr_pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "Russian"})
27
  return outputs["text"]
28
 
29