| @echo off |
| echo ======================================== |
| echo Deploying to Hugging Face Space |
| echo ======================================== |
| echo. |
|
|
| cd /d "%~dp0" |
|
|
| echo Checking git status... |
| git status |
| echo. |
|
|
| echo Adding all changes... |
| git add -A |
| echo. |
|
|
| echo Committing changes... |
| git commit -m "Update sci-image deployment" || echo No changes to commit |
| echo. |
|
|
| echo Setting up Hugging Face remote with authentication... |
| git remote remove hf >nul 2>&1 |
| echo Adding HF remote with token... |
| echo Please set HF_TOKEN environment variable or the script will prompt for it |
| if not defined HF_TOKEN ( |
| set /p HF_TOKEN="Enter your Hugging Face token: " |
| ) |
| git remote add hf https://%HF_TOKEN%@huggingface.co/spaces/gsstec/sci-image |
| echo. |
|
|
| echo Pulling latest changes from Hugging Face... |
| git pull hf main --rebase --allow-unrelated-histories |
| echo. |
|
|
| echo Pushing to Hugging Face... |
| echo Space URL: https://huggingface.co/spaces/gsstec/sci-image |
| echo. |
|
|
| git push hf main |
| echo. |
|
|
| if errorlevel 1 ( |
| echo. |
| echo ======================================== |
| echo Push failed! Trying with authentication... |
| echo ======================================== |
| echo. |
| echo Please run manually with your token: |
| echo git push https://YOUR_HF_TOKEN@huggingface.co/spaces/gsstec/sci-image main |
| echo. |
| ) else ( |
| echo. |
| echo ======================================== |
| echo Deployment successful! |
| echo ======================================== |
| echo. |
| ) |
|
|
| pause |
| |
| |
|
|