JoelJokku commited on
Commit
e0f07e3
·
1 Parent(s): 4c399e4

Updated codes

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -7,11 +7,17 @@ from transformers import pipeline
7
  import os
8
  from dotenv import load_dotenv
9
  from flask_cors import CORS
10
-
 
11
  load_dotenv()
 
 
12
  app=Flask(__name__)
13
  CORS(app)
14
- model=whisper.load_model("base")
 
 
 
15
  SAMPLE_RATE=16000
16
  DURATION=10
17
  OUTPUT_FILE="recorded_audio.wav"
 
7
  import os
8
  from dotenv import load_dotenv
9
  from flask_cors import CORS
10
+ # Add this before loading the model
11
+ os.environ["XDG_CACHE_HOME"] = os.getcwd() + "/.cache" # Set custom cache location
12
  load_dotenv()
13
+ # Then load the model
14
+
15
  app=Flask(__name__)
16
  CORS(app)
17
+ cache_dir = os.path.join(os.getcwd(), ".cache")
18
+ os.makedirs(cache_dir, exist_ok=True)
19
+ model = whisper.load_model("base", download_root=cache_dir) # Explicit cache location
20
+
21
  SAMPLE_RATE=16000
22
  DURATION=10
23
  OUTPUT_FILE="recorded_audio.wav"