name: audio2srt-localgen description: "Local-generate and deploy the Audio2SRT project — a MLX Whisper audio transcription and translation Web GUI for Apple Silicon Macs. Unlike audio2srt-deploy (which clones from Gitee), this skill generates the entire project from embedded templates on the local machine, requiring zero network access for source code. Installs Python and Node.js dependencies, auto-downloads MLX models from ModelScope, and launches both the backend (Python aiohttp, port 8765) and frontend (Vite + React, port 3000). Triggers: 本地生成audio2srt, 本地搭建轉錄工具, generate Audio2SRT, 生成音訊轉錄專案, local deploy mlx whisper, or any request to create/set up the audio2srt project without cloning from remote." agent_created: true
在本地從零生成並部署 Audio2SRT 專案 —— MLX Whisper 音訊轉錄與翻譯 Web GUI 工具。
與 audio2srt-deploy(需要從 Gitee 克隆)不同,本 Skill 將所有原始碼模板內嵌,執行時直接在目標目錄生成完整專案,無需任何網路訪問即可獲得原始碼。
以下關鍵詞或意圖觸發本 Skill:
| 觸發詞(中文) | 觸發詞(英文) |
|---|---|
| 本地生成audio2srt | generate Audio2SRT locally |
| 本地搭建轉錄工具 | create Audio2SRT project |
| 生成音訊轉錄專案 | local deploy mlx whisper |
| 不用克隆部署audio2srt | setup whisper tool without git |
| 從零搭建音訊轉錄 | build whisper GUI from scratch |
區分 audio2srt-deploy vs audio2srt-localgen:
audio2srt-deployaudio2srt-localgen)詢問使用者希望將專案生成到哪個目錄。預設值 ~/audio2srt。
如果目錄已存在且非空,詢問是否覆蓋(清空重建)或選擇其他目錄。
重要:不要在使用者的工作目錄或桌面下直接生成,建議使用 ~/audio2srt 或使用者明確指定的路徑。
按以下目錄結構,逐個使用 Write 工具生成所有檔案。所有檔案內容均來自本 Skill 的 references 目錄中的模板檔案。
目標目錄結構:
TARGET_DIR/
├── server/
│ ├── transcribe_server.py # Python 後端(MLX Whisper + mlx-lm)
│ └── requirements.txt # Python 依賴
├── src/
│ ├── components/
│ │ ├── DropZone.tsx # 檔案拖拽上傳
│ │ ├── FileCard.tsx # 任務卡片
│ │ ├── FileList.tsx # 檔案列表
│ │ ├── Header.tsx # 頂部欄
│ │ ├── ResultPanel.tsx # 轉錄結果面板
│ │ ├── SrtTranslatePage.tsx # SRT 翻譯頁面
│ │ ├── StatsBar.tsx # 統計面板
│ │ └── TranscriptionSettings.tsx # 轉錄引數設定
│ ├── store/
│ │ └── queueStore.ts # Zustand 狀態管理
│ ├── types/
│ │ └── index.ts # TypeScript 型別定義
│ ├── utils/
│ │ └── helpers.ts # 工具函式和 API 客戶端
│ ├── App.tsx # 應用主元件
│ ├── main.tsx # 入口檔案
│ └── index.css # 全域性樣式
├── models/ # 模型目錄(gitignored,執行時下載)
├── start.sh # 一鍵啟動指令碼
├── package.json # Node.js 依賴
├── index.html # HTML 入口
├── vite.config.ts # Vite 配置
├── tsconfig.json # TypeScript 配置
├── tsconfig.node.json # TypeScript Node 配置
├── tailwind.config.js # Tailwind CSS 配置
├── postcss.config.js # PostCSS 配置
├── .gitignore # Git 忽略規則
└── LICENSE # MIT 許可證
生成順序(按依賴關係):
package.json, tsconfig.json, tsconfig.node.json, vite.config.ts, tailwind.config.js, postcss.config.js, index.html, .gitignore, LICENSEserver/requirements.txt, server/transcribe_server.pysrc/types/index.ts, src/utils/helpers.ts, src/index.csssrc/store/queueStore.ts, src/components/*.tsx, src/App.tsx, src/main.tsxstart.sh關鍵要求:
- 讀取 references/ 目錄下的模板檔案,使用 Write 工具逐個寫入目標路徑
- 寫入 start.sh 後必須執行 chmod +x 賦予執行許可權
- 確保 models/ 目錄存在(mkdir -p TARGET_DIR/models)
7w4.net收錄了海量優質技能外掛。
cd TARGET_DIR
pip3 install -r server/requirements.txt
如果 pip 失敗:
- 嘗試 pip3 install --user -r server/requirements.txt
- 或建議使用虛擬環境:python3 -m venv venv && source venv/bin/activate && pip install -r server/requirements.txt
cd TARGET_DIR
npm install
cd TARGET_DIR
./start.sh
start.sh 自動執行:
- 檢測 models/whisper-large-v3-turbo 和 models/Qwen2.5-3B-Instruct-4bit 是否存在
- 從 ModelScope 下載缺失模型(首次約需 5~10 分鐘,共約 4GB+)
- 啟動 Python 後端(埠 8765)
- 啟動 Vite 前端(埠 3000)
啟動成功後,開啟瀏覽器訪問 http://localhost:3000。
| 模型 | ModelScope ID | 本地路徑 |
|---|---|---|
| Whisper 轉錄 | mlx-community/whisper-large-v3-turbo-4bit |
models/whisper-large-v3-turbo |
| Qwen 翻譯 | mlx-community/Qwen2.5-3B-Instruct-4bit |
models/Qwen2.5-3B-Instruct-4bit |
模型總計約 4GB+,首次下載需 5~10 分鐘。
| 服務 | 埠 | URL |
|---|---|---|
| 前端 (Vite + React) | 3000 | http://localhost:3000 |
| 後端 (Python aiohttp) | 8765 | http://localhost:8765 |
確保 ModelScope CLI 可用:
pip3 install modelscope
python3 -m modelscope.cli.download --model mlx-community/whisper-large-v3-turbo-4bit --local_dir models/whisper-large-v3-turbo
python3 -m modelscope.cli.download --model mlx-community/Qwen2.5-3B-Instruct-4bit --local_dir models/Qwen2.5-3B-Instruct-4bit
lsof -ti:3000 | xargs kill -9
lsof -ti:8765 | xargs kill -9
工具通過 macOS afconvert 自動轉換。確保 Xcode Command Line Tools 已安裝。
刪除 node_modules 和 package-lock.json 後重試:
rm -rf node_modules package-lock.json
npm install
這個 Skill 質量中等偏上,文件編寫清晰詳細,觸發條件區分合理,程式碼結構專業。優點是提供了完整的前後端程式碼和自動化啟動指令碼,故障排除指南實用。不足是部分配置模板檔案缺失,可能影響部署完整性。對於需要本地離線生成 Audio2SRT 專案的使用者來說,這是一個可用但需要手動補充少量檔案的解決方案。