Update README.md
Browse files
README.md
CHANGED
@@ -1,62 +1,73 @@
|
|
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 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
3. Access the Swagger documentation at `http://localhost:7860/docs`
|
|
|
1 |
+
---
|
2 |
+
title: Audio Emotion Detection API
|
3 |
+
emoji: 🎵
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: purple
|
6 |
+
sdk: docker
|
7 |
+
sdk_version: "latest"
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
---
|
11 |
+
|
12 |
+
# Audio Emotion Detection API
|
13 |
+
|
14 |
+
This application provides an API for detecting emotions in audio files using the wav2vec2 model fine-tuned for emotion recognition.
|
15 |
+
|
16 |
+
## Features
|
17 |
+
|
18 |
+
- Upload audio files for emotion analysis
|
19 |
+
- List all uploaded recordings
|
20 |
+
- Download previously uploaded recordings
|
21 |
+
- Analyze existing recordings
|
22 |
+
- Delete recordings
|
23 |
+
|
24 |
+
## API Endpoints
|
25 |
+
|
26 |
+
- `GET /health` - Health check endpoint
|
27 |
+
- `POST /upload` - Upload and analyze an audio file
|
28 |
+
- `GET /recordings` - List all uploaded recordings
|
29 |
+
- `GET /recordings/{filename}` - Download a specific recording
|
30 |
+
- `GET /analyze/{filename}` - Analyze an existing recording
|
31 |
+
- `DELETE /recordings/{filename}` - Delete a recording
|
32 |
+
|
33 |
+
## Supported Audio Formats
|
34 |
+
|
35 |
+
- WAV
|
36 |
+
- MP3
|
37 |
+
- OGG
|
38 |
+
- FLAC
|
39 |
+
|
40 |
+
## File Size Limits
|
41 |
+
|
42 |
+
Maximum file size: 10MB
|
43 |
+
|
44 |
+
## Usage Example
|
45 |
+
|
46 |
+
```python
|
47 |
+
import requests
|
48 |
+
|
49 |
+
# Upload and analyze an audio file
|
50 |
+
with open('your_audio.wav', 'rb') as f:
|
51 |
+
files = {'file': f}
|
52 |
+
response = requests.post('https://your-space-url.hf.space/upload', files=files)
|
53 |
+
print(response.json())
|
54 |
+
```
|
55 |
+
|
56 |
+
## Technical Details
|
57 |
+
|
58 |
+
- Based on FastAPI
|
59 |
+
- Uses Hugging Face's wav2vec2-base-superb-er model for emotion recognition
|
60 |
+
- Optimized for Hugging Face Spaces deployment
|
61 |
+
- Automatic file cleanup to manage storage limits
|
62 |
+
|
63 |
+
## Storage Management
|
64 |
+
|
65 |
+
Files are automatically cleaned up after 24 hours to manage storage limits on Hugging Face Spaces.
|
66 |
+
|
67 |
+
## Development
|
68 |
+
|
69 |
+
To run this API locally:
|
70 |
+
|
71 |
+
1. Install dependencies: `pip install -r requirements.txt`
|
72 |
+
2. Run the server: `python app.py`
|
73 |
3. Access the Swagger documentation at `http://localhost:7860/docs`
|