File size: 880 Bytes
5022405 | 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 | @echo off
setlocal
if "%~1"=="" goto :usage
if "%~2"=="" goto :usage
set HF_USERNAME=%~1
set HF_SPACE=%~2
set COMMIT_MSG=%~3
if "%COMMIT_MSG%"=="" set COMMIT_MSG=OpenEnv submission
if not exist .git (
git init -b main
)
git add .
git diff --cached --quiet
if errorlevel 1 (
git commit -m "%COMMIT_MSG%"
)
git remote remove hf >nul 2>nul
if not "%HF_TOKEN%"=="" (
git remote add hf https://%HF_USERNAME%:%HF_TOKEN%@huggingface.co/spaces/%HF_USERNAME%/%HF_SPACE%
) else (
git remote add hf https://huggingface.co/spaces/%HF_USERNAME%/%HF_SPACE%
)
git push -u hf main
if errorlevel 1 (
echo Push failed. If prompted, login with your Hugging Face username and token.
exit /b 1
)
echo Push complete: https://huggingface.co/spaces/%HF_USERNAME%/%HF_SPACE%
exit /b 0
:usage
echo Usage: scripts\deploy_hf.cmd ^<hf_username^> ^<space_name^> [commit_message]
exit /b 1
|