Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,13 @@ def transcribe(audio):
|
|
39 |
device=device,
|
40 |
)
|
41 |
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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(
|