49 lines
1.9 KiB
PowerShell

# Startup script for Windows PowerShell
# Run this to start the Document Translation API
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host " Document Translation API - Starting Server " -ForegroundColor Cyan
Write-Host "===============================================" -ForegroundColor Cyan
Write-Host ""
# Check if virtual environment exists
if (-Not (Test-Path ".\venv")) {
Write-Host "Virtual environment not found. Creating one..." -ForegroundColor Yellow
python -m venv venv
}
# Activate virtual environment
Write-Host "Activating virtual environment..." -ForegroundColor Green
& .\venv\Scripts\Activate.ps1
# Install dependencies if needed
Write-Host "Checking dependencies..." -ForegroundColor Green
pip install -r requirements.txt --quiet
# Create necessary directories
Write-Host "Creating directories..." -ForegroundColor Green
New-Item -ItemType Directory -Force -Path uploads | Out-Null
New-Item -ItemType Directory -Force -Path outputs | Out-Null
New-Item -ItemType Directory -Force -Path temp | Out-Null
# Copy .env.example to .env if .env doesn't exist
if (-Not (Test-Path ".\.env")) {
Write-Host "Creating .env file from template..." -ForegroundColor Yellow
Copy-Item .env.example .env
}
Write-Host ""
Write-Host "===============================================" -ForegroundColor Green
Write-Host " Starting API Server on http://localhost:8000 " -ForegroundColor Green
Write-Host "===============================================" -ForegroundColor Green
Write-Host ""
Write-Host "API Documentation available at:" -ForegroundColor Cyan
Write-Host " - Swagger UI: http://localhost:8000/docs" -ForegroundColor White
Write-Host " - ReDoc: http://localhost:8000/redoc" -ForegroundColor White
Write-Host ""
Write-Host "Press Ctrl+C to stop the server" -ForegroundColor Yellow
Write-Host ""
# Start the server
python main.py