blender-mask-peoples/run_server.sh
2026-02-12 18:52:55 +09:00

53 lines
1.4 KiB
Bash
Executable File
Raw Permalink 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.

#!/usr/bin/env bash
# 推論サーバーの単体起動スクリプト
set -e
echo "=== Face Detection Inference Server ==="
echo ""
# 環境変数の読み込み
if [ -f ".env" ]; then
echo "環境変数を読み込み中..."
export $(cat .env | grep -v '^#' | xargs)
else
echo "警告: .env ファイルが見つかりません"
fi
# 仮想環境の確認とアクティベート
if [ ! -d ".venv" ]; then
echo "エラー: .venv が見つかりません"
echo "仮想環境を作成してください: python -m venv .venv"
exit 1
fi
source .venv/bin/activate
# モデルの確認
MODEL_PATH="models/yolov8n-face-lindevs.pt"
if [ ! -f "$MODEL_PATH" ]; then
echo "警告: モデルファイルが見つかりません: $MODEL_PATH"
echo "最初のリクエスト時にエラーになる可能性があります"
echo ""
fi
# GPU情報の表示
echo "=== GPU情報 ==="
python -c "
import torch
if torch.cuda.is_available():
print(f'GPU検出: {torch.cuda.get_device_name(0)}')
print(f'ROCm version: {torch.version.hip if hasattr(torch.version, \"hip\") else \"N/A\"}')
else:
print('GPU未検出CPUモードで動作します')
" 2>/dev/null || echo "PyTorchが見つかりません"
echo ""
# サーバー起動
echo "=== サーバーを起動中 ==="
echo "URL: http://127.0.0.1:8181"
echo "終了するには Ctrl+C を押してください"
echo ""
python server/main.py