llm_perf_test/deploy.sh

51 lines
1.1 KiB
Bash
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.

#!/bin/bash
# LLM性能测试工具部署脚本
# 部署到8001端口
set -e
echo "=== LLM性能测试工具部署脚本 ==="
# 检查Python版本
if ! command -v python3 &> /dev/null; then
echo "错误: 未找到 Python3请先安装 Python3.8+"
exit 1
fi
PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
echo "Python版本: $PYTHON_VERSION"
# 创建虚拟环境
if [ ! -d "venv" ]; then
echo "创建虚拟环境..."
python3 -m venv venv
fi
# 激活虚拟环境
echo "激活虚拟环境..."
source venv/bin/activate
# 升级pip
echo "升级pip..."
pip install --upgrade pip
# 安装依赖
echo "安装依赖..."
pip install -r requirements.txt
# 检查端口是否被占用
if lsof -Pi :8001 -sTCP:LISTEN -t >/dev/null 2>&1; then
echo "警告: 端口8001已被占用尝试停止现有进程..."
kill $(lsof -t -i:8001) 2>/dev/null || true
sleep 2
fi
# 启动应用
echo "启动LLM性能测试工具 (端口: 8001)..."
echo "访问地址: http://localhost:8001"
echo ""
echo "按 Ctrl+C 停止服务"
echo "==================================="
python app.py