dosemate / run.ps1
DoseMate
Deploy DoseMate to Hugging Face Spaces
a0c836f
Raw History Blame Contribute Delete
1.24 kB
# PharmaChat — one-command production runner.
# Builds whatever is missing, then starts ONE server (API + UI) on http://localhost:8000
#
# Right-click -> Run with PowerShell, or: powershell -ExecutionPolicy Bypass -File run.ps1
$ErrorActionPreference = "Stop"
$dir = $PSScriptRoot
Set-Location $dir
Write-Host "PharmaChat launcher" -ForegroundColor Green
# 1) .env must exist
if (-not (Test-Path "$dir/.env")) {
Write-Host "ERROR: .env not found. Copy .env.example to .env and add GROQ_API_KEY + GOOGLE_API_KEY." -ForegroundColor Red
exit 1
}
# 2) Build the vector store if missing
if (-not (Test-Path "$dir/chroma_db")) {
Write-Host "Building ChromaDB (one-time)..." -ForegroundColor Cyan
python build_chroma.py
}
# 3) Build the frontend if missing
if (-not (Test-Path "$dir/frontend/dist/index.html")) {
Write-Host "Building frontend (one-time)..." -ForegroundColor Cyan
Push-Location "$dir/frontend"
if (-not (Test-Path "node_modules")) { npm install }
npm run build
Pop-Location
}
# 4) Start the single server
Write-Host "Starting PharmaChat on http://localhost:8000 ..." -ForegroundColor Green
Start-Process "http://localhost:8000"
python -m uvicorn main:app --host 0.0.0.0 --port 8000