ASI-Engineer commited on
Commit
9412500
·
verified ·
1 Parent(s): 5423248

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. requirements.txt +0 -27
  2. requirements_dev.txt +0 -123
  3. test_deployment.sh +0 -166
requirements.txt DELETED
@@ -1,27 +0,0 @@
1
- # Requirements for Hugging Face Spaces (Gradio app)
2
- # Minimal dependencies needed for the Gradio interface
3
- # Generated from pyproject.toml with essential packages only
4
-
5
- # Core ML libraries
6
- scikit-learn>=1.6.0,<1.7.0
7
- xgboost>=2.1.0,<3.0.0
8
- numpy>=2.0.0,<3.0.0
9
- pandas>=2.2.0,<3.0.0
10
- joblib>=1.4.0,<2.0.0
11
- scipy>=1.14.0,<2.0.0
12
-
13
- # Gradio and web framework
14
- gradio>=6.2.0,<7.0.0
15
- fastapi>=0.127.0,<1.0.0
16
- uvicorn[standard]>=0.32.0,<1.0.0
17
- pydantic>=2.10.0,<3.0.0
18
-
19
- # Data processing
20
- imbalanced-learn>=0.13.0,<1.0.0
21
-
22
- # Hugging Face
23
- huggingface-hub>=1.2.0,<2.0.0
24
-
25
- # Utilities
26
- python-dotenv>=1.0.0,<2.0.0
27
- python-json-logger>=4.0.0,<5.0.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements_dev.txt DELETED
@@ -1,123 +0,0 @@
1
- aiofiles==24.1.0 ; python_version >= "3.12" and python_version < "4.0"
2
- alembic==1.17.2 ; python_version >= "3.12" and python_version < "4.0"
3
- annotated-doc==0.0.4 ; python_version >= "3.12" and python_version < "4.0"
4
- annotated-types==0.7.0 ; python_version >= "3.12" and python_version < "4.0"
5
- anyio==4.12.0 ; python_version >= "3.12" and python_version < "4.0"
6
- audioop-lts==0.2.2 ; python_version >= "3.13" and python_version < "4.0"
7
- blinker==1.9.0 ; python_version >= "3.12" and python_version < "4.0"
8
- brotli==1.2.0 ; python_version >= "3.12" and python_version < "4.0"
9
- cachetools==6.2.4 ; python_version >= "3.12" and python_version < "4.0"
10
- certifi==2025.11.12 ; python_version >= "3.12" and python_version < "4.0"
11
- cffi==2.0.0 ; python_version >= "3.12" and python_version < "4.0" and platform_python_implementation != "PyPy"
12
- charset-normalizer==3.4.4 ; python_version >= "3.12" and python_version < "4.0"
13
- click==8.3.1 ; python_version >= "3.12" and python_version < "4.0"
14
- cloudpickle==3.1.2 ; python_version >= "3.12" and python_version < "4.0"
15
- colorama==0.4.6 ; python_version >= "3.12" and python_version < "4.0" and (platform_system == "Windows" or sys_platform == "win32")
16
- contourpy==1.3.3 ; python_version >= "3.12" and python_version < "4.0"
17
- cryptography==46.0.3 ; python_version >= "3.12" and python_version < "4.0"
18
- cycler==0.12.1 ; python_version >= "3.12" and python_version < "4.0"
19
- databricks-sdk==0.76.0 ; python_version >= "3.12" and python_version < "4.0"
20
- deprecated==1.3.1 ; python_version >= "3.12" and python_version < "4.0"
21
- docker==7.1.0 ; python_version >= "3.12" and python_version < "4.0"
22
- fastapi==0.127.1 ; python_version >= "3.12" and python_version < "4.0"
23
- ffmpy==1.0.0 ; python_version >= "3.12" and python_version < "4.0"
24
- filelock==3.20.1 ; python_version >= "3.12" and python_version < "4.0"
25
- flask-cors==6.0.2 ; python_version >= "3.12" and python_version < "4.0"
26
- flask==3.1.2 ; python_version >= "3.12" and python_version < "4.0"
27
- fonttools==4.61.1 ; python_version >= "3.12" and python_version < "4.0"
28
- fsspec==2025.12.0 ; python_version >= "3.12" and python_version < "4.0"
29
- gitdb==4.0.12 ; python_version >= "3.12" and python_version < "4.0"
30
- gitpython==3.1.45 ; python_version >= "3.12" and python_version < "4.0"
31
- google-auth==2.45.0 ; python_version >= "3.12" and python_version < "4.0"
32
- gradio-client==2.0.2 ; python_version >= "3.12" and python_version < "4.0"
33
- gradio==6.2.0 ; python_version >= "3.12" and python_version < "4.0"
34
- graphene==3.4.3 ; python_version >= "3.12" and python_version < "4.0"
35
- graphql-core==3.2.7 ; python_version >= "3.12" and python_version < "4.0"
36
- graphql-relay==3.2.0 ; python_version >= "3.12" and python_version < "4.0"
37
- greenlet==3.3.0 ; python_version >= "3.12" and python_version < "4.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32")
38
- groovy==0.1.2 ; python_version >= "3.12" and python_version < "4.0"
39
- gunicorn==23.0.0 ; python_version >= "3.12" and python_version < "4.0" and platform_system != "Windows"
40
- h11==0.16.0 ; python_version >= "3.12" and python_version < "4.0"
41
- hf-xet==1.2.0 ; python_version >= "3.12" and python_version < "4.0" and (platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "arm64" or platform_machine == "aarch64")
42
- httpcore==1.0.9 ; python_version >= "3.12" and python_version < "4.0"
43
- httptools==0.7.1 ; python_version >= "3.12" and python_version < "4.0"
44
- httpx==0.28.1 ; python_version >= "3.12" and python_version < "4.0"
45
- huey==2.5.5 ; python_version >= "3.12" and python_version < "4.0"
46
- huggingface-hub==1.2.3 ; python_version >= "3.12" and python_version < "4.0"
47
- idna==3.11 ; python_version >= "3.12" and python_version < "4.0"
48
- imbalanced-learn==0.13.0 ; python_version >= "3.12" and python_version < "4.0"
49
- importlib-metadata==8.7.1 ; python_version >= "3.12" and python_version < "4.0"
50
- itsdangerous==2.2.0 ; python_version >= "3.12" and python_version < "4.0"
51
- jinja2==3.1.6 ; python_version >= "3.12" and python_version < "4.0"
52
- joblib==1.5.3 ; python_version >= "3.12" and python_version < "4.0"
53
- kiwisolver==1.4.9 ; python_version >= "3.12" and python_version < "4.0"
54
- limits==5.6.0 ; python_version >= "3.12" and python_version < "4.0"
55
- mako==1.3.10 ; python_version >= "3.12" and python_version < "4.0"
56
- markdown-it-py==4.0.0 ; python_version >= "3.12" and python_version < "4.0"
57
- markupsafe==3.0.3 ; python_version >= "3.12" and python_version < "4.0"
58
- matplotlib==3.10.8 ; python_version >= "3.12" and python_version < "4.0"
59
- mdurl==0.1.2 ; python_version >= "3.12" and python_version < "4.0"
60
- mlflow-skinny==3.8.1 ; python_version >= "3.12" and python_version < "4.0"
61
- mlflow-tracing==3.8.1 ; python_version >= "3.12" and python_version < "4.0"
62
- mlflow==3.8.1 ; python_version >= "3.12" and python_version < "4.0"
63
- numpy==2.4.0 ; python_version >= "3.12" and python_version < "4.0"
64
- nvidia-nccl-cu12==2.28.9 ; python_version >= "3.12" and python_version < "4.0" and platform_system == "Linux" and platform_machine != "aarch64"
65
- opentelemetry-api==1.39.1 ; python_version >= "3.12" and python_version < "4.0"
66
- opentelemetry-proto==1.39.1 ; python_version >= "3.12" and python_version < "4.0"
67
- opentelemetry-sdk==1.39.1 ; python_version >= "3.12" and python_version < "4.0"
68
- opentelemetry-semantic-conventions==0.60b1 ; python_version >= "3.12" and python_version < "4.0"
69
- orjson==3.11.5 ; python_version >= "3.12" and python_version < "4.0"
70
- packaging==25.0 ; python_version >= "3.12" and python_version < "4.0"
71
- pandas==2.3.3 ; python_version >= "3.12" and python_version < "4.0"
72
- pillow==12.0.0 ; python_version >= "3.12" and python_version < "4.0"
73
- protobuf==6.33.2 ; python_version >= "3.12" and python_version < "4.0"
74
- psycopg2-binary==2.9.9 ; python_version >= "3.12" and python_version < "4.0"
75
- pyarrow==22.0.0 ; python_version >= "3.12" and python_version < "4.0"
76
- pyasn1-modules==0.4.2 ; python_version >= "3.12" and python_version < "4.0"
77
- pyasn1==0.6.1 ; python_version >= "3.12" and python_version < "4.0"
78
- pycparser==2.23 ; python_version >= "3.12" and python_version < "4.0" and platform_python_implementation != "PyPy" and implementation_name != "PyPy"
79
- pydantic-core==2.41.5 ; python_version >= "3.12" and python_version < "4.0"
80
- pydantic==2.12.5 ; python_version >= "3.12" and python_version < "4.0"
81
- pydub==0.25.1 ; python_version >= "3.12" and python_version < "4.0"
82
- pygments==2.19.2 ; python_version >= "3.12" and python_version < "4.0"
83
- pyparsing==3.3.1 ; python_version >= "3.12" and python_version < "4.0"
84
- python-dateutil==2.9.0.post0 ; python_version >= "3.12" and python_version < "4.0"
85
- python-dotenv==1.0.0 ; python_version >= "3.12" and python_version < "4.0"
86
- python-json-logger==4.0.0 ; python_version >= "3.12" and python_version < "4.0"
87
- python-multipart==0.0.21 ; python_version >= "3.12" and python_version < "4.0"
88
- pytz==2025.2 ; python_version >= "3.12" and python_version < "4.0"
89
- pywin32==311 ; python_version >= "3.12" and python_version < "4.0" and sys_platform == "win32"
90
- pyyaml==6.0.3 ; python_version >= "3.12" and python_version < "4.0"
91
- requests==2.32.5 ; python_version >= "3.12" and python_version < "4.0"
92
- rich==14.2.0 ; python_version >= "3.12" and python_version < "4.0"
93
- rsa==4.9.1 ; python_version >= "3.12" and python_version < "4.0"
94
- safehttpx==0.1.7 ; python_version >= "3.12" and python_version < "4.0"
95
- scikit-learn==1.6.1 ; python_version >= "3.12" and python_version < "4.0"
96
- scipy==1.16.3 ; python_version >= "3.12" and python_version < "4.0"
97
- semantic-version==2.10.0 ; python_version >= "3.12" and python_version < "4.0"
98
- shellingham==1.5.4 ; python_version >= "3.12" and python_version < "4.0"
99
- six==1.17.0 ; python_version >= "3.12" and python_version < "4.0"
100
- sklearn-compat==0.1.5 ; python_version >= "3.12" and python_version < "4.0"
101
- slowapi==0.1.9 ; python_version >= "3.12" and python_version < "4.0"
102
- smmap==5.0.2 ; python_version >= "3.12" and python_version < "4.0"
103
- sqlalchemy==2.0.23 ; python_version >= "3.12" and python_version < "4.0"
104
- sqlparse==0.5.5 ; python_version >= "3.12" and python_version < "4.0"
105
- starlette==0.50.0 ; python_version >= "3.12" and python_version < "4.0"
106
- threadpoolctl==3.6.0 ; python_version >= "3.12" and python_version < "4.0"
107
- tomlkit==0.13.3 ; python_version >= "3.12" and python_version < "4.0"
108
- tqdm==4.67.1 ; python_version >= "3.12" and python_version < "4.0"
109
- typer-slim==0.21.0 ; python_version >= "3.12" and python_version < "4.0"
110
- typer==0.21.0 ; python_version >= "3.12" and python_version < "4.0"
111
- typing-extensions==4.15.0 ; python_version >= "3.12" and python_version < "4.0"
112
- typing-inspection==0.4.2 ; python_version >= "3.12" and python_version < "4.0"
113
- tzdata==2025.3 ; python_version >= "3.12" and python_version < "4.0"
114
- urllib3==2.6.3 ; python_version >= "3.12" and python_version < "4.0"
115
- uvicorn==0.32.1 ; python_version >= "3.12" and python_version < "4.0"
116
- uvloop==0.22.1 ; python_version >= "3.12" and python_version < "4.0" and sys_platform != "win32" and sys_platform != "cygwin" and platform_python_implementation != "PyPy"
117
- waitress==3.0.2 ; python_version >= "3.12" and python_version < "4.0" and platform_system == "Windows"
118
- watchfiles==1.1.1 ; python_version >= "3.12" and python_version < "4.0"
119
- websockets==15.0.1 ; python_version >= "3.12" and python_version < "4.0"
120
- werkzeug==3.1.5 ; python_version >= "3.12" and python_version < "4.0"
121
- wrapt==2.0.1 ; python_version >= "3.12" and python_version < "4.0"
122
- xgboost==2.1.4 ; python_version >= "3.12" and python_version < "4.0"
123
- zipp==3.23.0 ; python_version >= "3.12" and python_version < "4.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_deployment.sh DELETED
@@ -1,166 +0,0 @@
1
- #!/bin/bash
2
- # Script de test avant déploiement sur HuggingFace Spaces
3
- # Vérifie que FastAPI et Gradio fonctionnent correctement ensemble
4
-
5
- set -e
6
-
7
- echo "=========================================="
8
- echo "🧪 Test de l'application avant déploiement"
9
- echo "=========================================="
10
-
11
- # Couleurs
12
- RED='\033[0;31m'
13
- GREEN='\033[0;32m'
14
- YELLOW='\033[1;33m'
15
- NC='\033[0m' # No Color
16
-
17
- # Fonction de nettoyage
18
- cleanup() {
19
- echo -e "\n${YELLOW}🧹 Nettoyage...${NC}"
20
- pkill -f "python app.py" 2>/dev/null || true
21
- pkill -f "uvicorn api:app" 2>/dev/null || true
22
- sleep 2
23
- }
24
-
25
- # Nettoyer avant de commencer
26
- cleanup
27
-
28
- # Trap pour nettoyer en cas d'interruption
29
- trap cleanup EXIT INT TERM
30
-
31
- echo -e "\n${YELLOW}1️⃣ Démarrage de l'application...${NC}"
32
-
33
- # Chercher l'environnement virtuel
34
- if [ -d ".venv" ]; then
35
- PYTHON=".venv/bin/python"
36
- elif [ -d "venv" ]; then
37
- PYTHON="venv/bin/python"
38
- else
39
- PYTHON="python3"
40
- fi
41
-
42
- echo -e "${YELLOW} Using Python: $PYTHON${NC}"
43
- $PYTHON app.py > /tmp/app_test.log 2>&1 &
44
- APP_PID=$!
45
-
46
- # Attendre le démarrage
47
- echo -e "${YELLOW}⏳ Attente du démarrage (20s)...${NC}"
48
- sleep 20
49
-
50
- # Vérifier que le processus tourne
51
- if ! ps -p $APP_PID > /dev/null; then
52
- echo -e "${RED}❌ L'application a crashé au démarrage${NC}"
53
- echo -e "\n${YELLOW}Logs:${NC}"
54
- tail -30 /tmp/app_test.log
55
- exit 1
56
- fi
57
-
58
- echo -e "${GREEN}✅ Application démarrée${NC}"
59
-
60
- # Test 1: Health check FastAPI
61
- echo -e "\n${YELLOW}2️⃣ Test health check FastAPI (port 8000)...${NC}"
62
- if curl -s -f http://localhost:8000/health > /dev/null; then
63
- echo -e "${GREEN}✅ FastAPI répond${NC}"
64
- curl -s http://localhost:8000/health | python3 -m json.tool 2>/dev/null || echo "{}"
65
- else
66
- echo -e "${RED}❌ FastAPI ne répond pas${NC}"
67
- tail -30 /tmp/app_test.log
68
- exit 1
69
- fi
70
-
71
- # Test 2: Gradio home
72
- echo -e "\n${YELLOW}3️⃣ Test interface Gradio (port 7860)...${NC}"
73
- if curl -s -f http://localhost:7860/ > /dev/null; then
74
- echo -e "${GREEN}✅ Gradio répond${NC}"
75
- else
76
- echo -e "${RED}❌ Gradio ne répond pas${NC}"
77
- tail -30 /tmp/app_test.log
78
- exit 1
79
- fi
80
-
81
- # Test 3: Prédiction API
82
- echo -e "\n${YELLOW}4️⃣ Test prédiction via API FastAPI...${NC}"
83
-
84
- # Récupérer la clé API depuis .env ou utiliser la clé par défaut
85
- if [ -f ".env" ]; then
86
- API_KEY=$(grep "^API_KEY=" .env | cut -d'=' -f2)
87
- else
88
- API_KEY="dev-key-change-me-in-production"
89
- fi
90
-
91
- RESPONSE=$(curl -s -X POST http://localhost:8000/predict \
92
- -H "Content-Type: application/json" \
93
- -H "X-API-Key: $API_KEY" \
94
- -d '{
95
- "nombre_participation_pee": 0,
96
- "nb_formations_suivies": 2,
97
- "nombre_employee_sous_responsabilite": 1,
98
- "distance_domicile_travail": 15,
99
- "niveau_education": 3,
100
- "domaine_etude": "Infra & Cloud",
101
- "ayant_enfants": "Y",
102
- "frequence_deplacement": "Occasionnel",
103
- "annees_depuis_la_derniere_promotion": 2,
104
- "annes_sous_responsable_actuel": 5,
105
- "satisfaction_employee_environnement": 3,
106
- "note_evaluation_precedente": 4,
107
- "niveau_hierarchique_poste": 2,
108
- "satisfaction_employee_nature_travail": 3,
109
- "satisfaction_employee_equipe": 3,
110
- "satisfaction_employee_equilibre_pro_perso": 2,
111
- "note_evaluation_actuelle": 4,
112
- "heure_supplementaires": "Non",
113
- "augementation_salaire_precedente": 5.5,
114
- "age": 35,
115
- "genre": "M",
116
- "revenu_mensuel": 4500.0,
117
- "statut_marital": "Marié(e)",
118
- "departement": "Commercial",
119
- "poste": "Manager",
120
- "nombre_experiences_precedentes": 3,
121
- "nombre_heures_travailless": 80,
122
- "annee_experience_totale": 10,
123
- "annees_dans_l_entreprise": 5,
124
- "annees_dans_le_poste_actuel": 2
125
- }')
126
-
127
- if echo "$RESPONSE" | grep -q "prediction"; then
128
- echo -e "${GREEN}✅ Prédiction réussie${NC}"
129
- echo "$RESPONSE" | python3 -m json.tool 2>/dev/null || echo "$RESPONSE"
130
- else
131
- echo -e "${RED}❌ Erreur lors de la prédiction${NC}"
132
- echo "$RESPONSE"
133
- exit 1
134
- fi
135
-
136
- # Test 4: Documentation Swagger
137
- echo -e "\n${YELLOW}5️⃣ Test documentation Swagger...${NC}"
138
- if curl -s -f http://localhost:8000/docs > /dev/null; then
139
- echo -e "${GREEN}✅ Documentation accessible${NC}"
140
- else
141
- echo -e "${RED}❌ Documentation non accessible${NC}"
142
- exit 1
143
- fi
144
-
145
- # Résumé final
146
- echo -e "\n=========================================="
147
- echo -e "${GREEN}✅ TOUS LES TESTS SONT PASSÉS !${NC}"
148
- echo -e "=========================================="
149
- echo ""
150
- echo "L'application est prête pour le déploiement sur HuggingFace Spaces."
151
- echo ""
152
- echo "Prochaines étapes :"
153
- echo "1. Committez vos changements : git add . && git commit -m 'Deploy FastAPI + Gradio'"
154
- echo "2. Poussez sur GitHub : git push origin main"
155
- echo "3. HF Spaces se synchronisera automatiquement"
156
- echo "4. Vérifiez les logs sur https://huggingface.co/spaces/votre-username/votre-space/logs"
157
- echo ""
158
- echo "URLs attendues sur HF Spaces :"
159
- echo " - Interface : https://votre-space.hf.space/"
160
- echo " - API interne : http://localhost:8000 (non publique)"
161
- echo ""
162
-
163
- # Nettoyer
164
- cleanup
165
-
166
- exit 0