# ICMR + HITEK Search API - One-Click Setup (PowerShell) # Total download: ~305 GB. Make sure you have enough space! $ErrorActionPreference = "Stop" $ProgressPreference = "SilentlyContinue" $DataRepo = "Kzr0xx/Icmr-and-hitek" $FullRepo = "Kzr0xx/icrm-hitek-full-db-mixed" $Files = @("part1.parquet", "part2a.parquet", "part2b_new.parquet") $Idx = @("idx_phone.0.parquet", "idx_phone.1.parquet", "idx_phone.2.parquet", "idx_phone.3.parquet", "idx_phone.4.parquet", "idx_phone.5.parquet", "idx_phone.6.parquet", "idx_aadhar.0.parquet", "idx_aadhar.1.parquet", "idx_aadhar.2.parquet", "idx_aadhar.3.parquet", "idx_aadhar.4.parquet", "idx_aadhar.5.parquet", "idx_aadhar.6.parquet") $Code = @("main.py", "build_index.py", "run_api.bat", "requirements.txt") $Root = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $Root $DataDir = Join-Path $Root "data" New-Item -ItemType Directory -Force -Path $DataDir | Out-Null function Download-File($Name, $Repo, $Dest) { if (Test-Path $Dest) { Write-Host " $Name already exists, skipping"; return } Write-Host " Downloading $Name ..." $url = "https://huggingface.co/datasets/$Repo/resolve/main/$Name" # curl.exe is bundled with Windows 10+ and supports resume (-C -) & curl.exe -L -C - -o $Dest $url if ($LASTEXITCODE -ne 0) { throw "FAILED: $Name" } } Write-Host "============================================================" Write-Host " ICMR + HITEK Search API - One-Click Setup (PowerShell)" Write-Host "============================================================" Write-Host "" Write-Host "[1/5] Downloading data files (104 GB)..." foreach ($f in $Files) { Download-File $f $DataRepo (Join-Path $DataDir $f) } Write-Host "[2/5] Downloading index parts (200 GB)..." foreach ($f in $Idx) { Download-File $f $FullRepo (Join-Path $DataDir $f) } Write-Host "[3/5] Downloading code files..." foreach ($f in $Code) { curl.exe -L -C - -o $f "https://huggingface.co/datasets/$FullRepo/resolve/main/$f" } Write-Host "[4/5] Setting up Python environment..." $py = Get-Command python -ErrorAction SilentlyContinue if (-not $py) { $py = Get-Command py -ErrorAction SilentlyContinue if (-not $py) { throw "Python not found! Install Python 3.11+ from https://www.python.org/downloads/" } & py -3 -m venv .venv } else { if (-not (Test-Path ".venv")) { python -m venv .venv } } & ".venv\Scripts\python.exe" -m pip install -q --upgrade pip & ".venv\Scripts\python.exe" -m pip install -q -r requirements.txt Write-Host "[5/5] Starting API server..." $env:ICMR_DATA_DIR = $DataDir Start-Process -FilePath ".venv\Scripts\python.exe" -ArgumentList "-m","uvicorn","main:app","--host","127.0.0.1","--port","8001","--workers","1" -WorkingDirectory $Root -WindowStyle Minimized Write-Host "" Write-Host "============================================================" Write-Host " API is starting on http://127.0.0.1:8001" Write-Host " Docs: http://127.0.0.1:8001/docs" Write-Host "============================================================"