@echo off rem onw-Image setup (Windows): finds Python 3.10+ (offers to install it with winget), creates .venv, installs the rem packages, downloads the model (~10 GB from Hugging Face), adds "onw-Image" to the Start menu and starts it. setlocal cd /d "%~dp0" set PYTHONUTF8=1 if not exist ".venv\Scripts\python.exe" goto create fc /b requirements.txt .venv\requirements.done >nul 2>&1 && goto model goto install :create call "%~dp0find_python.bat" if not defined PY ( pause exit /b 1 ) echo [setup] creating Python environment in .venv ... %PY% -m venv .venv if errorlevel 1 ( echo [setup] could not create the Python environment. pause exit /b 1 ) :install rem (the bundled pip is fine; a newer pip once failed to install packages that have scripts, so it is not upgraded) ".venv\Scripts\python.exe" -m pip install --disable-pip-version-check -r requirements.txt --extra-index-url https://storage.openvinotoolkit.org/simple/wheels/pre-release if not errorlevel 1 goto installed if defined RETRIED ( echo [setup] package installation failed. pause exit /b 1 ) echo [setup] installation failed; rebuilding the Python environment once ... set RETRIED=1 rmdir /s /q .venv if not defined PY call "%~dp0find_python.bat" %PY% -m venv .venv goto install :installed copy /y requirements.txt .venv\requirements.done >nul :model echo [setup] model ... ".venv\Scripts\python.exe" -m onw_image.fetch_model if errorlevel 1 ( echo [setup] the model download failed - run setup.bat again to resume. pause exit /b 1 ) rem Start menu entry: pythonw -m onw_image (no console window) set "PYW=%CD%\.venv\Scripts\pythonw.exe" powershell -NoProfile -Command ^ "$s = (New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('Programs') + '\onw-Image.lnk');" ^ "$s.TargetPath = '%PYW%'; $s.Arguments = '-m onw_image'; $s.WorkingDirectory = '%CD%';" ^ "$s.Description = 'onw-Image - text-to-image on the Intel NPU'; $s.IconLocation = '%CD%\onw_image\web\icon.ico,0'; $s.Save()" echo [setup] Start menu: onw-Image echo. echo [start] onw-Image is starting. The first start compiles the model for your NPU (Panther Lake: about 40 minutes, echo once); progress is shown in the window. Later starts take seconds. start "" "%PYW%" -m onw_image timeout /t 8 >nul