Initial commit: audio2text 双语字幕生成服务

- 音频/视频转双语(英/中)SRT 字幕,Docker 容器化,CPU 开发/GPU 生产同一份代码
- faster-whisper ASR(词级时间戳) + 断句时间戳重算 + NLLB 翻译(模型不共驻)
- 分片上传(断点续传) + SQLite 持久化 + 主页/历史/日志页面
- 历史页文件名搜索;缓存定时清理(默认保留7天,可配置)
- 双 Dockerfile(cpu/gpu) + setup/start/stop 脚本
This commit is contained in:
2026-07-06 06:54:19 +00:00
commit 00e2a95fb7
44 changed files with 4110 additions and 0 deletions

53
docker-compose.yml Normal file
View File

@@ -0,0 +1,53 @@
# audio2text — 双语字幕生成服务
# CPU dev / GPU prod 两套配置,按需切换 service。
#
# CPU 开发:
# docker compose up -d # 默认 cpu
# GPU 生产:
# docker compose -f docker-compose.yml up -d # 本机有 nvidia runtime 时自动用 gpu
#
# 模型缓存(/models跨容器复用首次启动下载、之后秒起。
services:
audio2text-cpu:
build:
context: .
args:
VARIANT: cpu
image: audio2text:cpu
container_name: audio2text
ports:
- "8000:8000"
volumes:
- ./data:/data
- ./models:/models
- ./config.yaml:/app/config.yaml:ro
environment:
CONFIG_PATH: /app/config.yaml
restart: unless-stopped
profiles: ["cpu", ""]
audio2text-gpu:
build:
context: .
args:
VARIANT: gpu
image: audio2text:gpu
container_name: audio2text
ports:
- "8000:8000"
volumes:
- ./data:/data
- ./models:/models
- ./config.yaml:/app/config.yaml:ro
environment:
CONFIG_PATH: /app/config.yaml
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
restart: unless-stopped
profiles: ["gpu"]