356a308f9b
- Add FastAPI microservice for infrared equipment fault detection - Add dual pyproject.toml: local development and Docker deployment - Add MANUAL_SETUP.md for manual file placement instructions - Add Dockerfile for containerized deployment - Add sample .env.example for PROJECT_ROOT configuration - Configure gitignore for weights, lib, venv, and environment files
59 lines
1.3 KiB
Markdown
59 lines
1.3 KiB
Markdown
# 手动部署说明
|
|
|
|
由于网络限制,权重文件和 whl 包需要手动放置到本地目录。
|
|
|
|
## 必需文件
|
|
|
|
### 1. whl 包
|
|
- **文件名**: `infrared_data-0.1.0-py3-none-any.whl`
|
|
- **存放路径**: `lib/infrared_data-0.1.0-py3-none-any.whl`
|
|
- **下载地址**: 联系项目维护者获取
|
|
|
|
### 2. 模型权重文件
|
|
- **文件名**: `best.pt`
|
|
- **存放路径**: `weights/best.pt`
|
|
- **下载地址**: 联系项目维护者获取
|
|
|
|
## 目录结构
|
|
|
|
```
|
|
.
|
|
├── lib/
|
|
│ └── infrared_data-0.1.0-py3-none-any.whl
|
|
├── weights/
|
|
│ └── best.pt
|
|
├── src/
|
|
│ ├── __init__.py
|
|
│ ├── config.py
|
|
│ └── main.py
|
|
├── tests/
|
|
├── pyproject.toml
|
|
└── Dockerfile
|
|
```
|
|
|
|
## 安装步骤
|
|
|
|
```bash
|
|
# 1. 放置上述文件到对应目录
|
|
|
|
# 2. 创建 .env 文件(包含项目路径)
|
|
# 注意:此文件包含绝对路径,每个开发者需要根据实际路径修改
|
|
cp .env.example .env # 或手动创建
|
|
|
|
# 3. 创建虚拟环境并安装依赖
|
|
set -a && source .env && uv sync
|
|
|
|
# 4. 启动服务
|
|
set -a && source .env && INFERENCE_DEVICE=cpu uv run uvicorn src.main:app --host 0.0.0.0 --port 8000
|
|
```
|
|
|
|
## 验证
|
|
|
|
```bash
|
|
# 健康检查
|
|
curl http://localhost:8000/health
|
|
|
|
# 测试推理
|
|
curl -X POST http://localhost:8000/infer -F "image=@your_image.jpg"
|
|
```
|