#!/bin/bash # Script para preparar y desplegar el Space en Hugging Face set -e echo "=== SimulStreaming ASR — Deployment Helper ===" # Verificar si está instalado huggingface-cli if ! command -v huggingface-cli &> /dev/null; then echo "❌ huggingface-cli no encontrado. Instálalo con:" echo " pip install huggingface-hub" exit 1 fi # Solicitar credenciales echo "" echo "1️⃣ Asegúrate de tener una cuenta en https://huggingface.co" read -p "Ingresa tu token de HF (desde https://huggingface.co/settings/tokens): " HF_TOKEN huggingface-cli login --token "$HF_TOKEN" # Solicitar nombre del Space read -p "¿Nombre del Space? (ej: simulstreaming-asr): " SPACE_NAME # Crear repo si no existe echo "" echo "2️⃣ Creando repositorio del Space..." SPACE_URL="https://huggingface.co/spaces/$(huggingface-cli whoami | grep username | awk '{print $2}')/$SPACE_NAME" mkdir -p "/tmp/$SPACE_NAME" cd "/tmp/$SPACE_NAME" git clone "https://huggingface.co/spaces/$(huggingface-cli whoami | grep username | awk '{print $2}')/$SPACE_NAME" . 2>/dev/null || { echo "Creando nuevo repositorio..." git clone "https://huggingface.co/spaces/$SPACE_NAME" . 2>/dev/null || true } echo "" echo "3️⃣ Copiando archivos..." cp -v /gpfs/projects/bsc88/speech/TTS/repos/Streaming_Mamba/SimulStreaming/space/* . echo "" echo "4️⃣ Configurando Git LFS para modelos..." git lfs install echo "*.pt filter=lfs diff=lfs merge=lfs -text" >> .gitattributes git add .gitattributes echo "" echo "5️⃣ Preparando para commit..." git add -A git commit -m "Initial commit: SimulStreaming ASR with Gradio UI + FastAPI backend" || true echo "" echo "6️⃣ Subiendo a Hugging Face Spaces..." git push echo "" echo "✅ ¡Space enviado exitosamente!" echo "📍 Monitorea en: $SPACE_URL" echo "" echo "Próximos pasos:" echo " 1. Abre $SPACE_URL en tu navegador" echo " 2. Espera a que el Space se construya y ejecute (~5-10 min)" echo " 3. ¡Prueba la grabación de audio!" echo ""