cigol123 commited on
Commit
d5f3eed
·
verified ·
1 Parent(s): 7fc018b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -4,9 +4,14 @@ from transformers import WhisperProcessor, WhisperForConditionalGeneration
4
  import soundfile as sf
5
  import numpy as np
6
  from scipy import signal
 
7
 
8
- processor = WhisperProcessor.from_pretrained("openai/whisper-large-v3")
9
- model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v3")
 
 
 
 
10
 
11
  def process_audio(audio_path):
12
  waveform, sr = sf.read(audio_path)
 
4
  import soundfile as sf
5
  import numpy as np
6
  from scipy import signal
7
+ import os
8
 
9
+ # Set up cache directory
10
+ os.environ['TRANSFORMERS_CACHE'] = '/code/.cache'
11
+ os.makedirs('/code/.cache', exist_ok=True)
12
+
13
+ processor = WhisperProcessor.from_pretrained("openai/whisper-large-v3", cache_dir='/code/.cache')
14
+ model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v3", cache_dir='/code/.cache')
15
 
16
  def process_audio(audio_path):
17
  waveform, sr = sf.read(audio_path)