ojas121 commited on
Commit
656615f
Β·
verified Β·
1 Parent(s): a9f8ee6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -10,10 +10,14 @@ import wave
10
  import json
11
  from vosk import Model, KaldiRecognizer
12
  from transformers import pipeline
13
- from huggingface_hub import snapshot_download
14
  from pydub import AudioSegment
15
  import noisereduce as nr
16
 
 
 
 
 
17
  # βœ… Auto-Download Vosk Model (Speech-to-Text)
18
  VOSK_MODEL = "vosk-model-small-en-us-0.15"
19
  if not os.path.exists(VOSK_MODEL):
@@ -26,7 +30,7 @@ if not os.path.exists(VOSK_MODEL):
26
  model = Model(VOSK_MODEL)
27
 
28
  # βœ… Auto-Download Wav2Vec2 Model (Emotion Detection)
29
- WAV2VEC_MODEL = "superb/wav2vec2-large-xlsr-53"
30
  if not os.path.exists(WAV2VEC_MODEL):
31
  st.write(f"Downloading {WAV2VEC_MODEL}...")
32
  snapshot_download(repo_id=WAV2VEC_MODEL, local_dir=WAV2VEC_MODEL)
 
10
  import json
11
  from vosk import Model, KaldiRecognizer
12
  from transformers import pipeline
13
+ from huggingface_hub import snapshot_download, login
14
  from pydub import AudioSegment
15
  import noisereduce as nr
16
 
17
+ # βœ… Authenticate Hugging Face to access models
18
+ HUGGINGFACE_TOKEN = "your_huggingface_token" # Replace with your token
19
+ login(token=HUGGINGFACE_TOKEN)
20
+
21
  # βœ… Auto-Download Vosk Model (Speech-to-Text)
22
  VOSK_MODEL = "vosk-model-small-en-us-0.15"
23
  if not os.path.exists(VOSK_MODEL):
 
30
  model = Model(VOSK_MODEL)
31
 
32
  # βœ… Auto-Download Wav2Vec2 Model (Emotion Detection)
33
+ WAV2VEC_MODEL = "facebook/wav2vec2-large-xlsr-53"
34
  if not os.path.exists(WAV2VEC_MODEL):
35
  st.write(f"Downloading {WAV2VEC_MODEL}...")
36
  snapshot_download(repo_id=WAV2VEC_MODEL, local_dir=WAV2VEC_MODEL)