Yoonc commited on
Commit
5485161
·
verified ·
1 Parent(s): d078060

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +13 -0
main.py CHANGED
@@ -4,6 +4,19 @@ A real-time speech emotion analysis tool for coaching sessions.
4
  """
5
 
6
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  import io
8
  import wave
9
  import pyaudio
 
4
  """
5
 
6
  import os
7
+
8
+ # Set cache directory to something writable in your Space
9
+ os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
10
+ os.environ["HF_HOME"] = "/app/cache"
11
+
12
+ # Make sure it exists
13
+ os.makedirs("/app/cache", exist_ok=True)
14
+
15
+
16
+ from transformers import pipeline
17
+ classifier = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
18
+
19
+
20
  import io
21
  import wave
22
  import pyaudio