Repository navigation
Expand file tree
/
Copy pathstart.bat
More file actions
91 lines (85 loc) · 3.86 KB
/
Copy pathstart.bat
File metadata and controls
91 lines (85 loc) · 3.86 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
@echo off
setlocal
set "APP_VERSION=v1.0 beta"
title KleinFlow %APP_VERSION%
for /F "delims=#" %%A in ('"prompt #$E# & for %%B in (1) do rem"') do set "ESC=%%A"
cls
echo %ESC%[38;2;139;92;246m
echo _ __ _ _ _____ _
echo ^| ^|/ /^| ^| ^(_) ^| ___^| ^|
echo ^| ' / ^| ^| ___ _ _ __ ^| ^|_ ^| ^| _____ __
echo ^| ^< ^| ^|/ _ \ ^| '_ \ ^| _^| ^| ^|/ _ \ \ /\ / /
echo ^| . \ ^| ^| __/ ^| ^| ^| ^|^| ^| ^| ^| ^(_) \ V V /
echo ^|_^|\_\^|_^|\___^|_^|_^| ^|_^|^|_^| ^|_^|\___/ \_/\_/
echo %ESC%[0m%ESC%[38;2;45;212;191m Portable FLUX.2 Klein Animation Studio ^| %APP_VERSION%%ESC%[0m
echo %ESC%[38;2;148;163;184m Fully portable Windows NVIDIA runtime ^| Gradio UI%ESC%[0m
echo.
set "APP_DIR=%~dp0"
set "PYTHON=%APP_DIR%portable\python\python.exe"
if not exist "%PYTHON%" set "PYTHON=%APP_DIR%portable\python\Scripts\python.exe"
set "FFMPEG_BIN=%APP_DIR%portable\ffmpeg\bin"
set "STARTUP_SPINNER=%APP_DIR%tools\startup_spinner.ps1"
if not exist "%PYTHON%" (
echo %ESC%[38;2;239;68;68m [FAILED] KleinFlow portable runtime was not found%ESC%[0m
echo %ESC%[38;2;100;116;139m ------------------------------------------------------------------------------%ESC%[0m
echo.
echo %ESC%[38;2;148;163;184m Missing:%ESC%[0m
echo %ESC%[38;2;226;232;240m %PYTHON%%ESC%[0m
echo.
echo %ESC%[38;2;249;115;22m [ACTION] Run build_kleinflow.bat to assemble the portable runtime.%ESC%[0m
echo %ESC%[38;2;148;163;184m Then run start.bat again.%ESC%[0m
echo.
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "[System.Media.SystemSounds]::Hand.Play(); Start-Sleep -Milliseconds 900" >nul 2>nul
pause
exit /b 1
)
echo %ESC%[38;2;34;197;94m [1/4] Portable Python ready%ESC%[0m
if not exist "%FFMPEG_BIN%\ffmpeg.exe" (
echo Bundled FFmpeg was not found:
echo %FFMPEG_BIN%\ffmpeg.exe
echo.
echo Restore portable\ffmpeg or rebuild the KleinFlow release folder.
pause
exit /b 1
)
"%FFMPEG_BIN%\ffmpeg.exe" -version >nul 2>&1
if errorlevel 1 (
echo Bundled FFmpeg is damaged or is not a Windows executable:
echo %FFMPEG_BIN%\ffmpeg.exe
echo.
echo Restore portable\ffmpeg before starting KleinFlow.
pause
exit /b 1
)
echo %ESC%[38;2;34;197;94m [2/4] Bundled FFmpeg verified%ESC%[0m
set "PATH=%FFMPEG_BIN%;%APP_DIR%portable\python;%APP_DIR%portable\python\Scripts;%PATH%"
set "HF_HOME=%APP_DIR%portable\hf_home"
set "HF_HUB_CACHE=%APP_DIR%portable\hf_cache"
set "HF_HUB_OFFLINE=1"
set "TORCH_HOME=%APP_DIR%portable\torch_home"
set "XDG_CACHE_HOME=%APP_DIR%portable\cache"
set "GRADIO_ANALYTICS_ENABLED=False"
set "PYTHONNOUSERSITE=1"
set "KLEINFLOW_SESSION_LOG=%APP_DIR%logs\KleinFlow-session.log"
set "KLEINFLOW_STARTUP_STATE_FILE="
if not exist "%APP_DIR%portable\cache" mkdir "%APP_DIR%portable\cache" >nul 2>nul
if exist "%APP_DIR%portable\cache" set "KLEINFLOW_STARTUP_STATE_FILE=%APP_DIR%portable\cache\kleinflow-startup-%RANDOM%-%RANDOM%.state"
if defined KLEINFLOW_STARTUP_STATE_FILE if exist "%KLEINFLOW_STARTUP_STATE_FILE%" del /q "%KLEINFLOW_STARTUP_STATE_FILE%" >nul 2>nul
echo %ESC%[38;2;34;197;94m [3/4] Portable environment configured%ESC%[0m
cd /d "%APP_DIR%"
echo Session log will be written to:
echo %KLEINFLOW_SESSION_LOG%
echo.
echo %ESC%[38;2;249;115;22m [4/4] Starting KleinFlow bootstrap...%ESC%[0m
if defined KLEINFLOW_STARTUP_STATE_FILE if exist "%STARTUP_SPINNER%" (
start "" /b powershell.exe -NoProfile -ExecutionPolicy Bypass -File "%STARTUP_SPINNER%" -StateFile "%KLEINFLOW_STARTUP_STATE_FILE%" -AppVersion "%APP_VERSION%"
)
"%PYTHON%" app.py
set "APP_EXIT=%ERRORLEVEL%"
if defined KLEINFLOW_STARTUP_STATE_FILE if not exist "%KLEINFLOW_STARTUP_STATE_FILE%" (
>"%KLEINFLOW_STARTUP_STATE_FILE%" echo failed
timeout /t 1 /nobreak >nul
)
if defined KLEINFLOW_STARTUP_STATE_FILE if exist "%KLEINFLOW_STARTUP_STATE_FILE%" del /q "%KLEINFLOW_STARTUP_STATE_FILE%" >nul 2>nul
pause
exit /b %APP_EXIT%