Download deploy.sh from gusmoon/TutorIA: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/gusmoon/TutorIA/resolve/main/deploy.sh
- Command line
-
hf download hf://spaces/gusmoon/TutorIA/deploy.sh
-
curl -L -o deploy.sh https://huggingface.co/spaces/gusmoon/TutorIA/resolve/main/deploy.sh
1.83 kB
| # Script de despliegue para Hugging Face Spaces | |
| # Uso: ./deploy.sh [mensaje_commit] | |
| set -e | |
| # Colores | |
| GREEN='\033[0;32m' | |
| BLUE='\033[0;34m' | |
| RED='\033[0;31m' | |
| NC='\033[0m' | |
| print_status() { | |
| echo -e "${BLUE}[INFO]${NC} $1" | |
| } | |
| print_success() { | |
| echo -e "${GREEN}[SUCCESS]${NC} $1" | |
| } | |
| print_error() { | |
| echo -e "${RED}[ERROR]${NC} $1" | |
| } | |
| # Verificar que estamos en un repositorio git | |
| if [ ! -d ".git" ]; then | |
| print_error "Este directorio no es un repositorio git" | |
| print_status "Ejecuta: git clone https://huggingface.co/spaces/tu-usuario/tu-space" | |
| exit 1 | |
| fi | |
| # Mensaje de commit | |
| COMMIT_MSG="${1:-Actualización de Tutorial AI App}" | |
| print_status "Preparando despliegue..." | |
| # Verificar archivos críticos | |
| critical_files=("app.py" "requirements.txt" "README.md") | |
| for file in "${critical_files[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| print_error "Archivo crítico no encontrado: $file" | |
| exit 1 | |
| fi | |
| done | |
| print_success "Archivos críticos verificados" | |
| # Agregar cambios | |
| print_status "Agregando cambios..." | |
| git add . | |
| # Verificar si hay cambios | |
| if git diff --staged --quiet; then | |
| print_status "No hay cambios para desplegar" | |
| exit 0 | |
| fi | |
| # Mostrar cambios | |
| print_status "Cambios a desplegar:" | |
| git diff --staged --name-only | |
| # Confirmar despliegue | |
| read -p "¿Continuar con el despliegue? (y/N): " -n 1 -r | |
| echo | |
| if [[ ! $REPLY =~ ^[Yy]$ ]]; then | |
| print_status "Despliegue cancelado" | |
| exit 0 | |
| fi | |
| # Hacer commit | |
| print_status "Creando commit..." | |
| git commit -m "$COMMIT_MSG" | |
| # Push a Hugging Face | |
| print_status "Desplegando a Hugging Face Spaces..." | |
| git push | |
| print_success "¡Despliegue completado!" | |
| print_status "Tu aplicación estará disponible en unos minutos en:" | |
| print_status "https://huggingface.co/spaces/$(git remote get-url origin | sed 's/.*spaces\///' | sed 's/\.git$//')" | |