File size: 2,037 Bytes
758929a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9d540bc
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
@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