Everton Aleixo commited on
Commit
b9f4b9a
1 Parent(s): 6f45890

Change asr

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -8,7 +8,19 @@ from transformers import SpeechT5ForTextToSpeech, SpeechT5HifiGan, SpeechT5Proce
8
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
9
 
10
  # load speech translation checkpoint
11
- asr_pipe = pipeline("automatic-speech-recognition", model="jonatasgrosman/whisper-large-pt-cv11", device=device)
 
 
 
 
 
 
 
 
 
 
 
 
12
  asr_pipe.model.config.forced_decoder_ids = (
13
  asr_pipe.tokenizer.get_decoder_prompt_ids(
14
  language="pt",
@@ -28,6 +40,7 @@ speaker_embeddings = torch.tensor(embeddings_dataset[7306]["xvector"]).unsqueeze
28
 
29
  def translate(audio):
30
  outputs = asr_pipe(audio)
 
31
  return outputs["text"]
32
 
33
 
 
8
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
9
 
10
  # load speech translation checkpoint
11
+ # asr_pipe = pipeline("automatic-speech-recognition", model="jonatasgrosman/whisper-large-pt-cv11", device=device)
12
+ # asr_pipe.model.config.forced_decoder_ids = (
13
+ # asr_pipe.tokenizer.get_decoder_prompt_ids(
14
+ # language="pt",
15
+ # task="transcribe"
16
+ # )
17
+ # )
18
+
19
+ asr_pipe = pipeline(
20
+ "automatic-speech-recognition",
21
+ model="jonatasgrosman/whisper-large-pt-cv11"
22
+ )
23
+
24
  asr_pipe.model.config.forced_decoder_ids = (
25
  asr_pipe.tokenizer.get_decoder_prompt_ids(
26
  language="pt",
 
40
 
41
  def translate(audio):
42
  outputs = asr_pipe(audio)
43
+ print('translate', outputs)
44
  return outputs["text"]
45
 
46