Kevin King commited on
Commit
0dcbb44
Β·
1 Parent(s): 1878486

REFAC: Update model loading to use 'tiny.en' for improved performance in Streamlit app

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +1 -3
src/streamlit_app.py CHANGED
@@ -15,7 +15,6 @@ import pandas as pd
15
  from sklearn.metrics.pairwise import cosine_similarity
16
  import matplotlib.pyplot as plt
17
 
18
- # --- THIS IS THE FINAL FIX ---
19
  # Create a cross-platform, writable cache directory for all libraries
20
  CACHE_DIR = os.path.join(tempfile.gettempdir(), "affectlink_cache")
21
  DEEPFACE_CACHE_PATH = os.path.join(CACHE_DIR, ".deepface", "weights")
@@ -23,7 +22,6 @@ os.makedirs(DEEPFACE_CACHE_PATH, exist_ok=True) # Proactively create the full pa
23
 
24
  os.environ['DEEPFACE_HOME'] = CACHE_DIR
25
  os.environ['HF_HOME'] = CACHE_DIR
26
- # ===========================
27
 
28
  # --- Page Configuration ---
29
  st.set_page_config(page_title="AffectLink Demo", page_icon="😊", layout="wide")
@@ -48,7 +46,7 @@ AUDIO_SAMPLE_RATE = 16000
48
  @st.cache_resource
49
  def load_models():
50
  with st.spinner("Loading AI models, this may take a moment..."):
51
- whisper_model = whisper.load_model("base.en", download_root=os.path.join(CACHE_DIR, "whisper"))
52
  text_classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", top_k=None)
53
  ser_model_name = "superb/hubert-large-superb-er"
54
  ser_feature_extractor = AutoFeatureExtractor.from_pretrained(ser_model_name)
 
15
  from sklearn.metrics.pairwise import cosine_similarity
16
  import matplotlib.pyplot as plt
17
 
 
18
  # Create a cross-platform, writable cache directory for all libraries
19
  CACHE_DIR = os.path.join(tempfile.gettempdir(), "affectlink_cache")
20
  DEEPFACE_CACHE_PATH = os.path.join(CACHE_DIR, ".deepface", "weights")
 
22
 
23
  os.environ['DEEPFACE_HOME'] = CACHE_DIR
24
  os.environ['HF_HOME'] = CACHE_DIR
 
25
 
26
  # --- Page Configuration ---
27
  st.set_page_config(page_title="AffectLink Demo", page_icon="😊", layout="wide")
 
46
  @st.cache_resource
47
  def load_models():
48
  with st.spinner("Loading AI models, this may take a moment..."):
49
+ whisper_model = whisper.load_model("tiny.en", download_root=os.path.join(CACHE_DIR, "whisper"))
50
  text_classifier = pipeline("text-classification", model="j-hartmann/emotion-english-distilroberta-base", top_k=None)
51
  ser_model_name = "superb/hubert-large-superb-er"
52
  ser_feature_extractor = AutoFeatureExtractor.from_pretrained(ser_model_name)