GLM-ASR
](https://hub.docker.com/r/neosun/glm-asr)   
基于GLM ASR Nano的多功能语音识别服务
Web UI•REST API•SSE流媒体•Swagger文档
______________________________________________________________________
🖥️ 截图
______________________________________________________________________
✨ 特性
- 🎯 高精度 -基于GLM-ASR-Nano-2512(1.5B),性能优于Whisper V3
- 🌍 17种语言 -中文、英语、广东话、日语、韩语等
- 🎤 长音频 -VAD智能分段,音频长度不受限制
- 🚀 SSE流媒体 -长音频的实时进度和结果
- 🖥️ Web用户界面 -现代暗模式界面,支持4种语言
- 🔌 REST API -带有Swagger文档的完整API
- 💾 GPU管理 -手动加载/卸载内存控制
- 🐳 Docker就绪 -带有预加载模型的一个命令部署
______________________________________________________________________
🚀 快速开始
Docker(推荐)
docker run -d --gpus all -p 7860:7860 neosun/glm-asr:v2.0.1访问权限:
- Web用户界面:http://localhost:7860
- Swagger文档:http://localhost:7860/docs
- 重新记录:http://localhost:7860/redoc
Docker Compose
git clone https://github.com/neosun100/glm-asr.git
cd glm-asr
docker compose up -d______________________________________________________________________
📖 api参考
基本URL
http://localhost:7860端点
健康检查
GET /health{"status": "ok", "model_loaded": true}转录(同步)-用于短音频
POST /api/transcribe
Content-Type: multipart/form-data| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| file | 文件 | 必需 | 音频文件(wav/mp3/flac/m4a/ogg/webm) |
| max_new_tokens | int | 512 | 最大输出令牌数(1-2048) |
curl -X POST http://localhost:7860/api/transcribe \
-F "file=@audio.mp3" \
-F "max_new_tokens=512"{"status": "success", "text": "Transcribed text here..."}转录(SSE流)-用于长音频
POST /api/transcribe/stream
Content-Type: multipart/form-data返回服务器发送的事件及其实时进度:
| 事件类型 | 描述 | 示例 |
|---|---|---|
start | 处理已开始 | {"type": "start"} |
progress | 分部进度 | {"type": "progress", "current": 3, "total": 10, "duration": 22.5} |
partial | 细分结果 | {"type": "partial", "text": "Segment text..."} |
done | 完成 | {"type": "done", "text": "Full transcription..."} |
error | 发生错误 | {"type": "error", "message": "Error details"} |
curl -X POST http://localhost:7860/api/transcribe/stream \
-F "file=@long_audio.mp3"GPU状态
GET /gpu/status{
"model_loaded": true,
"device": "cuda",
"gpu_memory_used_mb": 4320.5,
"gpu_memory_total_mb": 24576.0
}装载/卸载模型
POST /gpu/load
POST /gpu/unload交互式文档
- Swagger用户界面: http://localhost:7860/docs
- ReDoc: http://localhost:7860/redoc
______________________________________________________________________
⚙️ 配置
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
MODEL_CHECKPOINT | zai-org/GLM-ASR-Nano-2512 | HuggingFace模型路径 |
PORT | 7860 | 服务端口 |
HF_HOME | /app/cache | 模型缓存目录 |
docker-compose.yml
services:
glm-asr:
image: neosun/glm-asr:v2.0.1
container_name: glm-asr
ports:
- "7860:7860"
volumes:
- ./cache:/app/cache
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]______________________________________________________________________
🏗️ 技术栈
| 组件 | 技术 |
|---|---|
| 型号 | GLM-ASR-Nano-2512(1.5B) |
| 后端 | FastAPI+Uvicorn |
| 流媒体 | 服务器发送事件(SSE) |
| 前端 | HTML5+香草JS |
| 容器 | Docker+NVIDIA CUDA |
| API文档 | Swagger/ReDoc |
______________________________________________________________________
📊 基准
GLM ASR Nano在同类型号中实现了最低的平均错误率(4.10):
______________________________________________________________________
📝 更新日志
v2.0.1(2025-12-28)
- ✅ 迁移到FastAPI异步框架
- ✅ SSE流媒体实时进度
- ✅ 完整的Swagger API文档
- ✅ API双模式:同步+流
- ✅ 修复了长音频浏览器超时问题
- ✅ 带有进度显示的现代深色UI
v1.1.0(2025-12-15)
- ✅ VAD 智能分割
- ✅ 支持无限音频长度
v1.0.0(2025-12-14)
- ✅ 初始版本
- ✅ 支持4种语言的Web UI
- ✅ 带有Swagger文档的REST API
- ✅ Docker一体化镜像
______________________________________________________________________
📄 许可证
______________________________________________________________________
⭐ 明星历史

