@echo off echo ============================================ echo Deploy chatbot to Hugging Face Space echo ============================================ echo. cd /d "D:\Nouveau dossier\chatbot\chatbot" echo [1/3] Checking HF_TOKEN... if "%HF_TOKEN%"=="" ( echo HF_TOKEN not found in environment. echo Reading from .env file... for /f "tokens=1* delims==" %%a in ('findstr /B "HF_TOKEN=" .env') do ( set "HF_TOKEN=%%b" ) ) if "%HF_TOKEN%"=="" ( echo ERROR: HF_TOKEN not found! Add it to .env file. pause exit /b 1 ) echo HF_TOKEN: %HF_TOKEN:~10%... echo. echo [2/3] Logging in to Hugging Face... huggingface-cli login --token %HF_TOKEN% if errorlevel 1 ( echo ERROR: huggingface-cli not found. Install with: pip install huggingface_hub pause exit /b 1 ) echo. echo [3/3] Uploading to Space: mortadhabbb/chatbot-sports_academies-system... python -c " import os, sys from huggingface_hub import HfApi, create_repo token = os.environ.get('HF_TOKEN', '') space_id = 'mortadhabbb/chatbot-sports_academies-system' folder = r'D:\Nouveau dossier\chatbot\chatbot' api = HfApi(token=token) print('Creating space repo if needed...') create_repo(repo_id=space_id, token=token, repo_type='space', exist_ok=True) print('Uploading files...') api.upload_folder( folder_path=folder, repo_id=space_id, repo_type='space', commit_message='Deploy chatbot with auto-training on HF Space startup', ignore_patterns=[ '__pycache__/*','*.pyc','*.pyo','.git/*','db.sqlite3', 'logs/*','staticfiles/*','*.log','.venv/*','env_py10/*', 'get-pip.py','artifacts/*','push_to_hf.py','deploy_to_hf.bat', 'requirements_old.txt','requirements-ml.txt','requirements-runtime-ml.txt', ], ) print('DONE! https://huggingface.co/spaces/' + space_id) " echo. echo ============================================ echo Deployment complete! echo https://huggingface.co/spaces/mortadhabbb/chatbot-sports_academies-system echo ============================================ pause