-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserve.sh
More file actions
executable file
·38 lines (30 loc) · 905 Bytes
/
serve.sh
File metadata and controls
executable file
·38 lines (30 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Start the API server for SQL Category Classifier
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
echo "=============================================="
echo "SQL Category Classifier - API Server"
echo "=============================================="
echo ""
# Activate virtual environment
if [ -f "venv/bin/activate" ]; then
source venv/bin/activate
else
echo "Error: Virtual environment not found. Run ./setup.sh first."
exit 1
fi
# Check for trained model
if [ ! -f "models/best_model.pt" ]; then
echo "Error: No trained model found. Run ./run_train.sh first."
exit 1
fi
# Parse arguments
PORT=${1:-8000}
HOST=${2:-0.0.0.0}
echo "Starting server at http://$HOST:$PORT"
echo "Press Ctrl+C to stop"
echo ""
# Run server
cd src/api
python -c "import uvicorn; uvicorn.run('api_server:app', host='$HOST', port=$PORT, reload=False)"