92 lines
2.3 KiB
Plaintext
92 lines
2.3 KiB
Plaintext
|
|
# ============================================
|
|||
|
|
# Whisper 服务器端安装命令清单
|
|||
|
|
# ============================================
|
|||
|
|
|
|||
|
|
# 一、配置 pip 使用清华镜像(加速下载)
|
|||
|
|
# ============================================
|
|||
|
|
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 二、安装 Python 依赖包
|
|||
|
|
# ============================================
|
|||
|
|
# 安装 Flask 和 Flask-CORS
|
|||
|
|
pip install flask==2.3.0 flask-cors==4.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|||
|
|
|
|||
|
|
# 注意:openai-whisper 你已经安装了,跳过
|
|||
|
|
# 如果需要重新安装:
|
|||
|
|
# pip install openai-whisper -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 三、验证安装
|
|||
|
|
# ============================================
|
|||
|
|
pip list | grep -E "flask|whisper|cors"
|
|||
|
|
|
|||
|
|
# 应该看到:
|
|||
|
|
# flask 2.3.0
|
|||
|
|
# flask-cors 4.0.0
|
|||
|
|
# openai-whisper (已安装的版本)
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 四、上传 whisper_server.py 到服务器
|
|||
|
|
# ============================================
|
|||
|
|
# 在本地电脑执行(上传文件到服务器):
|
|||
|
|
# scp whisper_server.py user@服务器IP:/path/to/目录/
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 五、启动 Whisper 服务
|
|||
|
|
# ============================================
|
|||
|
|
|
|||
|
|
# 方式1:前台运行(测试用)
|
|||
|
|
python whisper_server.py
|
|||
|
|
|
|||
|
|
# 方式2:后台运行(推荐)
|
|||
|
|
nohup python whisper_server.py > whisper.log 2>&1 &
|
|||
|
|
|
|||
|
|
# 查看日志
|
|||
|
|
tail -f whisper.log
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 六、验证服务是否启动成功
|
|||
|
|
# ============================================
|
|||
|
|
curl http://localhost:5001/health
|
|||
|
|
|
|||
|
|
# 或从其他机器访问
|
|||
|
|
curl http://服务器IP:5001/health
|
|||
|
|
|
|||
|
|
# 应该返回:
|
|||
|
|
# {
|
|||
|
|
# "status": "ok",
|
|||
|
|
# "service": "Whisper语音识别服务",
|
|||
|
|
# "model": "base"
|
|||
|
|
# }
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 七、开放防火墙端口(如果访问不通)
|
|||
|
|
# ============================================
|
|||
|
|
|
|||
|
|
# CentOS/RHEL:
|
|||
|
|
firewall-cmd --permanent --add-port=5001/tcp
|
|||
|
|
firewall-cmd --reload
|
|||
|
|
|
|||
|
|
# Ubuntu/Debian:
|
|||
|
|
ufw allow 5001/tcp
|
|||
|
|
|
|||
|
|
# 查看防火墙状态
|
|||
|
|
firewall-cmd --list-ports # CentOS
|
|||
|
|
ufw status # Ubuntu
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 八、查看服务运行状态
|
|||
|
|
# ============================================
|
|||
|
|
ps aux | grep whisper # 查看进程
|
|||
|
|
netstat -tunlp | grep 5001 # 查看端口
|
|||
|
|
|
|||
|
|
|
|||
|
|
# 九、停止服务
|
|||
|
|
# ============================================
|
|||
|
|
# 查找进程ID
|
|||
|
|
ps aux | grep whisper_server.py
|
|||
|
|
|
|||
|
|
# 停止进程
|
|||
|
|
kill -9 进程ID
|