TaahKay commited on
Commit
90fe9f1
·
verified ·
1 Parent(s): b9a1431

Update models/model_loader.py

Browse files
Files changed (1) hide show
  1. models/model_loader.py +2 -1
models/model_loader.py CHANGED
@@ -14,6 +14,7 @@ os.makedirs(CACHE_DIR, exist_ok=True)
14
  # Load Model (Cached)
15
  # -------------------------------
16
 
 
17
  def load_accent_model():
18
  """Loads custom accent classification model."""
19
  if not os.getenv("HF_TOKEN"):
@@ -30,6 +31,6 @@ def load_accent_model():
30
  st.error(f"❌ Error loading model: {e}")
31
  st.stop()
32
 
33
-
34
  def load_whisper():
35
  return WhisperModel("tiny", device="cpu", compute_type="int8_float32")
 
14
  # Load Model (Cached)
15
  # -------------------------------
16
 
17
+ @st.cache_resource(show_spinner="Loading model...") # making sure we only load the model once per every app instance
18
  def load_accent_model():
19
  """Loads custom accent classification model."""
20
  if not os.getenv("HF_TOKEN"):
 
31
  st.error(f"❌ Error loading model: {e}")
32
  st.stop()
33
 
34
+ @st.cache_resource(show_spinner="Loading Whisper...")
35
  def load_whisper():
36
  return WhisperModel("tiny", device="cpu", compute_type="int8_float32")