File size: 2,708 Bytes
30ce80e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
setlocal enabledelayedexpansion
chcp 65001 >nul
title ICMR+HITEK API - One-Click Setup
echo ============================================================
echo  ICMR + HITEK Search API - One-Click Setup (Windows)
echo  Total download: ~305 GB. Make sure you have enough space!
echo ============================================================
echo.

set "DATA_REPO=Kzr0xx/Icmr-and-hitek"
set "FULL_REPO=Kzr0xx/icrm-hitek-full-db-mixed"
set "FILES=part1.parquet part2a.parquet part2b_new.parquet"
set "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"
set "CODE=main.py build_index.py run_api.bat requirements.txt"

if not exist "%~dp0data" mkdir "%~dp0data"
cd /d "%~dp0"

echo [1/5] Downloading data files (104 GB)...
for %%f in (%FILES%) do (
    if not exist "data\%%f" (
        echo   Downloading %%f ...
        curl -L -C - -o "data\%%f" "https://huggingface.co/datasets/%DATA_REPO%/resolve/main/%%f"
        if errorlevel 1 ( echo   FAILED: %%f & pause & exit /b 1 )
    ) else (
        echo   %%f already exists, skipping
    )
)

echo [2/5] Downloading index parts (200 GB)...
for %%f in (%IDX%) do (
    if not exist "data\%%f" (
        echo   Downloading %%f ...
        curl -L -C - -o "data\%%f" "https://huggingface.co/datasets/%FULL_REPO%/resolve/main/%%f"
        if errorlevel 1 ( echo   FAILED: %%f & pause & exit /b 1 )
    ) else (
        echo   %%f already exists, skipping
    )
)

echo [3/5] Downloading code files...
for %%f in (%CODE%) do (
    curl -L -C - -o "%%f" "https://huggingface.co/datasets/%FULL_REPO%/resolve/main/%%f"
)

echo [4/5] Setting up Python environment...
set "PYCMD=python"
where python >nul 2>nul
if errorlevel 1 (
    where py >nul 2>nul
    if errorlevel 1 (
        echo   Python not found! Install Python 3.11+ from https://www.python.org/downloads/
        pause & exit /b 1
    )
    set "PYCMD=py -3"
)
if not exist ".venv" %PYCMD% -m venv .venv
".venv\Scripts\python.exe" -m pip install -q --upgrade pip
".venv\Scripts\python.exe" -m pip install -q -r requirements.txt

echo [5/5] Starting API server...
set "ICMR_DATA_DIR=%~dp0data"
start "ICMR+HITEK API" /min ".venv\Scripts\python.exe" -m uvicorn main:app --host 127.0.0.1 --port 8001 --workers 1
echo.
echo ============================================================
echo  API is starting on http://127.0.0.1:8001
echo  Docs: http://127.0.0.1:8001/docs
echo ============================================================
timeout /t 5 >nul
pause