EurekaPotato commited on
Commit
c844a3d
Β·
verified Β·
1 Parent(s): dd1ad9b

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -0
  2. handler.py +19 -11
  3. requirements.txt +2 -3
Dockerfile CHANGED
@@ -9,6 +9,7 @@ RUN apt-get update && apt-get install -y \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  COPY requirements.txt .
 
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
  COPY handler.py .
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  COPY requirements.txt .
12
+ RUN pip install --no-cache-dir torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cpu
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
  COPY handler.py .
handler.py CHANGED
@@ -21,6 +21,22 @@ import warnings
21
  warnings.filterwarnings("ignore")
22
 
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  # ──────────────────────────────────────────────────────────────────────── #
25
  # Emotion CNN (mirrors src/emotion_features.py EmotionCNN)
26
  # ──────────────────────────────────────────────────────────────────────── #
@@ -281,17 +297,9 @@ async def global_exception_handler(request: Request, exc: Exception):
281
 
282
  extractor = AudioFeatureExtractorEndpoint()
283
 
284
- DEFAULT_AUDIO_FEATURES = {
285
- "v1_snr": 0.0,
286
- "v2_noise_traffic": 0.0, "v2_noise_office": 0.0,
287
- "v2_noise_crowd": 0.0, "v2_noise_wind": 0.0, "v2_noise_clean": 1.0,
288
- "v3_speech_rate": 0.0,
289
- "v4_pitch_mean": 0.0, "v5_pitch_std": 0.0,
290
- "v6_energy_mean": 0.0, "v7_energy_std": 0.0,
291
- "v8_pause_ratio": 0.0, "v9_avg_pause_dur": 0.0, "v10_mid_pause_cnt": 0,
292
- "v11_emotion_stress": 0.0, "v12_emotion_energy": 0.0, "v13_emotion_valence": 0.0,
293
- }
294
-
295
 
296
  class AudioBase64Request(BaseModel):
297
  audio_base64: str = ""
 
21
  warnings.filterwarnings("ignore")
22
 
23
 
24
+ # ──────────────────────────────────────────────────────────────────────── #
25
+ # Constants & Defaults
26
+ # ──────────────────────────────────────────────────────────────────────── #
27
+
28
+ DEFAULT_AUDIO_FEATURES = {
29
+ "v1_snr": 0.0,
30
+ "v2_noise_traffic": 0.0, "v2_noise_office": 0.0,
31
+ "v2_noise_crowd": 0.0, "v2_noise_wind": 0.0, "v2_noise_clean": 1.0,
32
+ "v3_speech_rate": 0.0,
33
+ "v4_pitch_mean": 0.0, "v5_pitch_std": 0.0,
34
+ "v6_energy_mean": 0.0, "v7_energy_std": 0.0,
35
+ "v8_pause_ratio": 0.0, "v9_avg_pause_dur": 0.0, "v10_mid_pause_cnt": 0,
36
+ "v11_emotion_stress": 0.0, "v12_emotion_energy": 0.0, "v13_emotion_valence": 0.0,
37
+ }
38
+
39
+
40
  # ──────────────────────────────────────────────────────────────────────── #
41
  # Emotion CNN (mirrors src/emotion_features.py EmotionCNN)
42
  # ──────────────────────────────────────────────────────────────────────── #
 
297
 
298
  extractor = AudioFeatureExtractorEndpoint()
299
 
300
+ # ──────────────────────────────────────────────────────────────────────── #
301
+ # Constants & Defaults
302
+ # ──────────────────────────────────────────────────────────────────────── #
 
 
 
 
 
 
 
 
303
 
304
  class AudioBase64Request(BaseModel):
305
  audio_base64: str = ""
requirements.txt CHANGED
@@ -5,9 +5,8 @@ numpy==1.24.3
5
  scipy==1.11.2
6
 
7
  # ML
8
- torch==2.1.0
9
- torchvision==0.16.0
10
- scikit-image==0.22.0
11
  matplotlib==3.8.2
12
 
13
  # API
 
5
  scipy==1.11.2
6
 
7
  # ML
8
+
9
+
 
10
  matplotlib==3.8.2
11
 
12
  # API