Spaces:
Runtime error
Runtime error
@echo off | |
REM Script de déploiement automatisé pour Hugging Face Spaces (Windows) | |
REM Usage: deploy.bat <votre-username> [audio-sentiment] | |
setlocal enabledelayedexpansion | |
REM Vérification des arguments | |
if "%~1"=="" ( | |
echo [ERROR] Usage: deploy.bat ^<votre-username^> [audio-sentiment] | |
echo Exemple: deploy.bat john audio-sentiment | |
exit /b 1 | |
) | |
set USERNAME=%~1 | |
if "%~2"=="" ( | |
set SPACE_NAME=audio-sentiment | |
) else ( | |
set SPACE_NAME=%~2 | |
) | |
if not "%SPACE_NAME%"=="audio-sentiment" ( | |
echo [WARNING] Le nom du Space recommande est 'audio-sentiment' (actuel: %SPACE_NAME%) | |
) | |
set SPACE_URL=https://huggingface.co/spaces/%USERNAME%/%SPACE_NAME% | |
echo [INFO] Démarrage du déploiement pour %SPACE_URL% | |
REM 1. Vérification de la structure du projet | |
echo [INFO] Vérification de la structure du projet... | |
set required_files=app_with_api.py requirements_hf.txt README.md .gitattributes src\__init__.py src\transcription.py src\sentiment.py src\multimodal.py src\inference.py | |
for %%f in (%required_files%) do ( | |
if not exist "%%f" ( | |
echo [ERROR] Fichier manquant: %%f | |
exit /b 1 | |
) else ( | |
echo [OK] %%f | |
) | |
) | |
echo [SUCCESS] Structure du projet validée | |
REM 2. Test du projet | |
echo [INFO] Exécution des tests... | |
if exist "test_deployment.py" ( | |
python test_deployment.py | |
if errorlevel 1 ( | |
echo [ERROR] Les tests ont échoué. Corrigez les problèmes avant de continuer. | |
exit /b 1 | |
) | |
echo [SUCCESS] Tests passés avec succès | |
) else ( | |
echo [WARNING] Script de test non trouvé, passage des tests... | |
) | |
REM 3. Vérification de Git | |
echo [INFO] Vérification de Git... | |
git --version >nul 2>&1 | |
if errorlevel 1 ( | |
echo [ERROR] Git n'est pas installé | |
exit /b 1 | |
) | |
REM 4. Initialisation Git si nécessaire | |
if not exist ".git" ( | |
echo [INFO] Initialisation du repository Git... | |
git init | |
git add . | |
git commit -m "Initial commit" | |
) | |
REM 5. Ajout du remote Hugging Face | |
echo [INFO] Configuration du remote Hugging Face... | |
git remote remove hf 2>nul | |
git remote add hf %SPACE_URL% | |
echo [SUCCESS] Remote configuré: %SPACE_URL% | |
REM 6. Préparation du commit | |
echo [INFO] Préparation du commit... | |
git add . | |
git commit -m "Deploy: Analyse de sentiment audio v1.0" 2>nul || ( | |
echo [WARNING] Aucun changement détecté, commit ignoré | |
) | |
REM 7. Déploiement | |
echo [INFO] Déploiement sur Hugging Face Spaces... | |
set /p confirm="Voulez-vous déployer maintenant ? (y/N): " | |
if /i not "%confirm%"=="y" ( | |
echo [WARNING] Déploiement annulé | |
exit /b 0 | |
) | |
echo [INFO] Poussage du code... | |
git push hf main | |
if errorlevel 1 ( | |
echo [ERROR] Erreur lors du push vers Hugging Face | |
exit /b 1 | |
) | |
echo [SUCCESS] Déploiement terminé avec succès ! | |
echo [SUCCESS] Votre Space est accessible à: %SPACE_URL% | |
echo. | |
echo [INFO] Instructions post-déploiement: | |
echo 1. Allez sur %SPACE_URL% | |
echo 2. Attendez que le build se termine (peut prendre 5-10 minutes) | |
echo 3. Testez votre application | |
echo 4. Consultez les logs en cas de problème | |
echo [INFO] Vérification du statut du Space... | |
echo Vous pouvez vérifier le statut à: %SPACE_URL% | |
echo [SUCCESS] Script de déploiement terminé ! | |
pause |