ntia / check_space_status.py
Ntdeseb's picture
Agregar funcionalidad de gráficos vectoriales SVG con SVGDreamer y modelos Microsoft
8d8ad99
#!/usr/bin/env python3
"""
Script para verificar el estado del Space NTIA directamente
"""
import requests
import json
import os
def check_space_status():
"""Verificar el estado del Space NTIA"""
print("🔍 Verificando estado del Space NTIA...")
print("=" * 60)
# URL del Space
space_url = "https://ntdeseb-ntia.hf.space"
try:
# Verificar si el Space está activo
response = requests.get(space_url, timeout=10)
print(f"✅ Space activo: {response.status_code}")
# Verificar la API del Space
api_url = f"{space_url}/api/predict/"
response = requests.get(api_url, timeout=10)
print(f"✅ API disponible: {response.status_code}")
# Intentar obtener el estado del Space
status_url = f"{space_url}/api/predict/get_space_status"
response = requests.post(status_url, json={}, timeout=10)
if response.status_code == 200:
data = response.json()
print("📊 Estado del Space:")
print(f" - Autenticación: {data.get('authentication', {}).get('authenticated', 'N/A')}")
print(f" - GPU: {data.get('quota', {}).get('gpu_type', 'N/A')}")
print(f" - Plan: {data.get('quota', {}).get('plan', 'N/A')}")
print(f" - Cuota disponible: {data.get('quota', {}).get('quota_available', 'N/A')}")
else:
print(f"❌ No se pudo obtener estado: {response.status_code}")
except Exception as e:
print(f"❌ Error verificando Space: {e}")
print("\n💡 Recomendaciones:")
print("1. Verifica que tengas el plan Pro activo en Hugging Face")
print("2. Configura las variables de entorno del Space:")
print(" - HF_TOKEN=tu_token_aqui")
print(" - SPACES_GPU_TIMEOUT=30")
print(" - SPACES_GPU_MEMORY=8")
print("3. Ve a Settings → Billing en Hugging Face")
print("4. Asegúrate de tener ZeroGPU Plan Pro activo")
if __name__ == "__main__":
check_space_status()