84 lines
2.8 KiB
PowerShell
84 lines
2.8 KiB
PowerShell
# PowerShell script to run FLUX.1 Edit MCP Server
|
|
|
|
Write-Host "Starting FLUX.1 Edit MCP Server..." -ForegroundColor Green
|
|
Write-Host "================================" -ForegroundColor Green
|
|
|
|
# Check if Python is available
|
|
try {
|
|
$pythonVersion = python --version
|
|
Write-Host "Found Python: $pythonVersion" -ForegroundColor Blue
|
|
} catch {
|
|
Write-Host "Error: Python is not installed or not in PATH" -ForegroundColor Red
|
|
Write-Host "Please install Python 3.8 or higher" -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Check if virtual environment exists
|
|
if (-not (Test-Path "venv")) {
|
|
Write-Host "Creating virtual environment..." -ForegroundColor Yellow
|
|
python -m venv venv
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Error: Failed to create virtual environment" -ForegroundColor Red
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Activate virtual environment
|
|
Write-Host "Activating virtual environment..." -ForegroundColor Blue
|
|
& "venv\Scripts\Activate.ps1"
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Error: Failed to activate virtual environment" -ForegroundColor Red
|
|
Write-Host "You might need to enable PowerShell script execution:" -ForegroundColor Yellow
|
|
Write-Host "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Install/upgrade dependencies
|
|
Write-Host "Installing dependencies..." -ForegroundColor Blue
|
|
pip install -r requirements.txt
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Error: Failed to install dependencies" -ForegroundColor Red
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Check if .env file exists
|
|
if (-not (Test-Path ".env")) {
|
|
Write-Host "Warning: .env file not found" -ForegroundColor Yellow
|
|
Write-Host "Please copy .env.example to .env and configure your FLUX_API_KEY" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "Creating .env from example..." -ForegroundColor Blue
|
|
Copy-Item ".env.example" ".env"
|
|
Write-Host ""
|
|
Write-Host "Please edit .env file and add your FLUX_API_KEY before running the server" -ForegroundColor Red
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Create directories if they don't exist
|
|
@("input_images", "generated_images", "temp") | ForEach-Object {
|
|
if (-not (Test-Path $_)) {
|
|
New-Item -ItemType Directory -Path $_ | Out-Null
|
|
Write-Host "Created directory: $_" -ForegroundColor Blue
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Starting FLUX.1 Edit MCP Server..." -ForegroundColor Green
|
|
Write-Host "Press Ctrl+C to stop the server" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
# Run the server
|
|
try {
|
|
python main.py
|
|
} catch {
|
|
Write-Host "Error running server: $_" -ForegroundColor Red
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Server stopped." -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|