-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_lmcc_windows.ps1
52 lines (45 loc) · 1.81 KB
/
run_lmcc_windows.ps1
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Get the directory of the current script
$SCRIPT_DIR = Split-Path -Parent $MyInvocation.MyCommand.Definition
# Function to check and install Python
function Install-Python {
if (-not (Get-Command python3 -ErrorAction SilentlyContinue)) {
Write-Output "Python3 could not be found. Installing Python3..."
if ($IsLinux) {
sudo apt update
sudo apt install -y python3 python3-pip
} elseif ($IsMacOS) {
# Check if Homebrew is installed, install if not
if (-not (Get-Command brew -ErrorAction SilentlyContinue)) {
Write-Output "Homebrew could not be found. Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
}
brew install python3
} elseif ($IsWindows) {
Write-Output "Please install Python3 manually on Windows from https://www.python.org/downloads/"
exit 1
} else {
Write-Output "Unknown OS type. Please install Python3 manually."
exit 1
}
} else {
Write-Output "Python3 is already installed."
}
}
# Function to install Python dependencies
function Install-PythonDependencies {
Write-Output "Installing Python dependencies..."
pip3 install -r "$SCRIPT_DIR\requirements.txt"
}
# Check and install Python
Install-Python
# Install Python dependencies
Install-PythonDependencies
# Install npm dependencies
Write-Output "Installing npm dependencies..."
npm install
# Start the server
Write-Output "Starting the server with npm start..."
Start-Process -NoNewWindow -FilePath "npm" -ArgumentList "start"
# Start the FastAPI server
Write-Output "Starting the FastAPI server with uvicorn..."
python -m uvicorn server.server:app --host 0.0.0.0 --port 8000 --reload