demavior commited on
Commit
b783d61
·
verified ·
1 Parent(s): 978eb8c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -39,7 +39,13 @@ def transcribe(audio):
39
  device=device,
40
  )
41
 
42
- prediction = pipe(audio_np)["text"]
 
 
 
 
 
 
43
  return prediction
44
 
45
  gradio_app = gr.Interface(
 
39
  device=device,
40
  )
41
 
42
+ # Create an attention mask
43
+ attention_mask = np.ones(audio_np.shape, dtype=np.int64)
44
+
45
+ # Use EncoderDecoderCache for past_key_values
46
+ past_key_values = EncoderDecoderCache.from_legacy_cache(None)
47
+
48
+ prediction = pipe(audio_np, attention_mask=attention_mask, past_key_values=past_key_values)["text"]
49
  return prediction
50
 
51
  gradio_app = gr.Interface(