wiki/z-archive/test-local-llm/start-python.ps1

54 lines
2 KiB
PowerShell

# Belegscanner - Python Web App Starter
# Poweron Design
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host " Belegscanner - KI-Dokumentenanalyse" -ForegroundColor White
Write-Host " Powered by Poweron" -ForegroundColor Magenta
Write-Host "============================================================" -ForegroundColor Cyan
Write-Host ""
# Ollama mit CORS starten (optional)
Write-Host "[1/3] Starte Ollama mit CORS-Freigabe..." -ForegroundColor Yellow
$env:OLLAMA_ORIGINS = "*"
# Versuche Ollama zu finden und zu starten
$ollamaPath = Get-Command ollama -ErrorAction SilentlyContinue
if ($ollamaPath) {
Start-Process -FilePath $ollamaPath.Source -ArgumentList "serve" -WindowStyle Minimized
Write-Host " Ollama gestartet" -ForegroundColor Green
} else {
# Fallback: Standard-Installationspfade pruefen
$defaultPaths = @(
"$env:LOCALAPPDATA\Programs\Ollama\ollama.exe",
"$env:ProgramFiles\Ollama\ollama.exe",
"C:\Users\$env:USERNAME\AppData\Local\Programs\Ollama\ollama.exe"
)
$found = $false
foreach ($path in $defaultPaths) {
if (Test-Path $path) {
Start-Process -FilePath $path -ArgumentList "serve" -WindowStyle Minimized
Write-Host " Ollama gestartet von: $path" -ForegroundColor Green
$found = $true
break
}
}
if (-not $found) {
Write-Host " Ollama nicht gefunden - bitte manuell starten!" -ForegroundColor Red
Write-Host " Setze OLLAMA_ORIGINS=* vor dem Start" -ForegroundColor Gray
}
}
Start-Sleep -Seconds 2
# Dependencies installieren
Write-Host "[2/3] Installiere Python Dependencies..." -ForegroundColor Yellow
pip install -r requirements.txt --quiet
Write-Host "[3/3] Starte Flask Server..." -ForegroundColor Yellow
Write-Host ""
Write-Host "Server URL: http://localhost:5000" -ForegroundColor Green
Write-Host "Druecke Ctrl+C zum Beenden" -ForegroundColor Gray
Write-Host ""
# Flask Server starten
python app.py