songrate/README.md
yumoqing 44a2ac9bb7 feat: songrate 初始版本 - 音乐多维度评估系统
- 7 大维度分析器: 节奏/可舞性/能量/情绪/调性/音色/音频质量
- 6 种场景配置: pop/classical/electronic/rock/jazz/hiphop
- 4 个 API: scenes/dimensions/config/evaluate
- 基于 librosa 的纯算法分析(CPU 即可运行)
- nginx IP 白名单认证(无 RBAC)
2026-06-03 18:01:08 +08:00

66 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# songrate — 音乐多维度评估系统
基于场景化权重的音乐质量评估 HTTP 服务。
## 特性
- **场景化评分**: 不同音乐类型使用不同权重(流行/古典/电子/摇滚/爵士/嘻哈)
- **7 大维度**: 节奏、可舞性、能量、情绪、调性、音色、音频质量
- **加权总分**: 各维度小分 × 权重 = 最终评分
## 部署
```bash
# 1. 安装依赖
pip install -r requirements.txt
# 2. 注册路径
python scripts/load_path.py
# 3. 启动服务 (端口 8900)
ahserver -p 8900
```
## nginx 配置
```nginx
location /songrate/api/ {
allow <SAGE_SERVER_IP>;
allow 127.0.0.1;
deny all;
proxy_pass http://127.0.0.1:8900;
proxy_read_timeout 300s;
}
```
## API
| 方法 | 路径 | 说明 |
|------|------|------|
| GET | /songrate/api/scenes.dspy | 获取可用场景 |
| GET | /songrate/api/dimensions.dspy?scene=pop | 获取维度树及权重 |
| POST | /songrate/api/config.dspy | 设置场景权重 |
| POST | /songrate/api/evaluate.dspy | 评估歌曲 |
### 评估示例
```bash
curl -X POST http://localhost:8900/songrate/api/evaluate.dspy \
-F "filepath=/path/to/song.mp3" \
-F "scene=pop"
```
返回:
```json
{
"total_score": 7.85,
"scene": "pop",
"scene_name": "流行音乐",
"dimensions": [
{"key": "rhythm", "name": "节奏", "score": 8.2, "weight": 0.25, "weighted": 2.05, "details": {...}},
{"key": "danceability", "name": "可舞性", "score": 7.5, "weight": 0.20, "weighted": 1.50, "details": {...}},
...
]
}
```