Files
20260512-skg-tk/api/README.md

34 lines
888 B
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.
# SKG TK 二创 API
FastAPI 后端,跑 yt-dlp + ffmpeg + Gemini ASR/翻译 管线。
## 启动
```bash
cd api
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # 按需填 GEMINI_API_KEY
uvicorn main:app --port 4291 --reload
```
## 路由
- `GET /health` — 健康检查 + 配置状态
- `POST /jobs` `{url}` — 创建 job后台跑下载/拆轨/抽帧
- `GET /jobs/{id}` — 当前状态 + 产物
- `POST /jobs/{id}/transcribe` — 触发 Gemini ASR + 翻译
- `GET /jobs/{id}/video.mp4` — 原视频
- `GET /jobs/{id}/frames/{i}.jpg` — 第 i 张关键帧0-9
## Mock 模式
未设 `GEMINI_API_KEY` 时,转录走本地 mock便于 UI 联调。
## 依赖
- `ffmpeg` 系统二进制(拆轨 / 抽帧)
- `yt-dlp` 系统二进制(也可走 Python 包)
- `google-generativeai` PythonASR + 翻译)