File size: 1,345 Bytes
a8d1301
61f8b55
a8d1301
61f8b55
a8d1301
 
61f8b55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: SER Wav2Vec
sdk: docker
app_port: 7860
---

# 🎀 Speech Emotion Recognition β€” Wav2Vec2 (FastAPI + Docker)

This Hugging Face Space provides a backend API for **Speech Emotion Recognition (SER)**  
using the Wav2Vec2ForSequenceClassification model.

The backend is implemented using **FastAPI** and runs inside a **Docker** container  
that exposes the `/predict` endpoint to accept audio and return emotion scores.

---

## πŸš€ API Endpoints

### **1. Health Check**

##/GET

Example Response:
```json
{ "status": "ok" }

Emotion Prediction
POST /predict
| field | type   | description                     |
| ----- | ------ | ------------------------------- |
| file  | binary | audio file (.wav / .mp3 / .m4a) |


curl -X POST "https://marshal-yash-SER_wav2vec.hf.space/predict" \
  -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "[email protected]"


{
  "results": [
    { "label": "happy", "score": 0.71 },
    { "label": "neutral", "score": 0.15 },
    { "label": "sad", "score": 0.08 }
  ],
  "dominant": { "label": "happy", "score": 0.71 }
}


β”œβ”€β”€ server.py          # FastAPI application
β”œβ”€β”€ Dockerfile         # Docker config for HF Spaces
β”œβ”€β”€ requirements.txt   # Python dependencies
└── README.md          # Documentation (this file)


marshal-yash/SER_wav2vec