@echo off REM ============================================================ REM Deploy to Hugging Face Spaces - Windows Batch Script REM ============================================================ REM Usage: deploy_spaces.bat [username] [spacename] REM Example: deploy_spaces.bat neev2211 arabic-native-classifier REM ============================================================ setlocal enabledelayedexpansion set "HF_USER=%~1" set "SPACE_NAME=%~2" if "%HF_USER%"=="" ( set /p HF_USER="Enter your Hugging Face username: " ) if "%SPACE_NAME%"=="" ( set /p SPACE_NAME="Enter Space name: " ) echo. echo ======================================== echo Hugging Face Spaces Deployment echo ======================================== echo Username: %HF_USER% echo Space: %SPACE_NAME% echo URL: https://huggingface.co/spaces/%HF_USER%/%SPACE_NAME% echo ======================================== echo. set /p CONFIRM="Continue? (y/n): " if /i not "%CONFIRM%"=="y" ( echo Deployment cancelled. exit /b 0 ) REM Check HF CLI auth echo. echo [1/6] Checking authentication... huggingface-cli whoami >nul 2>&1 if errorlevel 1 ( echo Not logged in. Please login: huggingface-cli login if errorlevel 1 ( echo ERROR: Login failed. exit /b 1 ) ) echo OK - Authenticated. REM Check models exist echo. echo [2/6] Checking models... if not exist "models\nativity_model.pth" ( echo ERROR: models\nativity_model.pth not found! exit /b 1 ) echo OK - Models found. REM Backup .gitignore and temporarily allow models echo. echo [3/6] Preparing .gitignore... copy /y .gitignore .gitignore.backup >nul REM Remove "models/" line from .gitignore findstr /v /c:"models/" .gitignore.backup > .gitignore echo OK - Temporarily allowing models in git. REM Stage files echo. echo [4/6] Staging files... git add models\nativity_model.pth git add models\best_threshold.txt git add models\lgbm_nativity.txt git add Dockerfile docker-compose.yml README.md requirements.txt .dockerignore git add webapp\ git add scripts\ git add manifests\embedding_dim.txt manifests\test_data.csv git add DEPLOY_HF.md QUICKSTART.md echo OK - Files staged. REM Commit echo. echo [5/6] Committing... set "COMMIT_MSG=Deploy to Hugging Face Spaces" set /p COMMIT_MSG="Commit message (Enter for default): " git commit -m "%COMMIT_MSG%" REM Configure remote echo. echo [6/6] Pushing to Hugging Face Spaces... set "REMOTE_URL=https://huggingface.co/spaces/%HF_USER%/%SPACE_NAME%" git remote remove space >nul 2>&1 git remote add space %REMOTE_URL% echo Pushing to %REMOTE_URL% ... echo This may take several minutes for large model files... echo. git push space main --force if errorlevel 1 ( echo. echo PUSH FAILED! Check errors above. echo Make sure you created the Space at: https://huggingface.co/new-space ) else ( echo. echo ======================================== echo SUCCESS! Deployment in progress. echo ======================================== echo App URL: https://%HF_USER%-%SPACE_NAME%.hf.space echo Monitor: https://huggingface.co/spaces/%HF_USER%/%SPACE_NAME% echo Build time: ~5-10 minutes echo ======================================== ) REM Restore .gitignore echo. echo Restoring .gitignore... move /y .gitignore.backup .gitignore >nul echo OK - .gitignore restored. echo. echo Done! endlocal