Update VEO3 Free Space configuration
Browse files- requirements.txt +2 -2
- upload_to_space.py +143 -0
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52afff36e08376ddacc083e5bdfd6b11259265e624b36573c6d821b6e90b6378
|
| 3 |
+
size 574
|
upload_to_space.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Script para subir archivos al Space de Hugging Face
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
import subprocess
|
| 8 |
+
import sys
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
|
| 11 |
+
def run_command(command, cwd=None):
|
| 12 |
+
"""Ejecuta un comando y retorna el resultado"""
|
| 13 |
+
try:
|
| 14 |
+
result = subprocess.run(command, shell=True, capture_output=True, text=True, cwd=cwd)
|
| 15 |
+
return result.returncode == 0, result.stdout, result.stderr
|
| 16 |
+
except Exception as e:
|
| 17 |
+
return False, "", str(e)
|
| 18 |
+
|
| 19 |
+
def check_git_status():
|
| 20 |
+
"""Verifica el estado de Git"""
|
| 21 |
+
print("🔍 Verificando estado de Git...")
|
| 22 |
+
|
| 23 |
+
# Verificar si estamos en un repositorio Git
|
| 24 |
+
success, stdout, stderr = run_command("git status")
|
| 25 |
+
if not success:
|
| 26 |
+
print("❌ No es un repositorio Git. Inicializando...")
|
| 27 |
+
run_command("git init")
|
| 28 |
+
run_command("git add .")
|
| 29 |
+
run_command('git commit -m "Initial commit"')
|
| 30 |
+
return True
|
| 31 |
+
|
| 32 |
+
print("✅ Repositorio Git encontrado")
|
| 33 |
+
return True
|
| 34 |
+
|
| 35 |
+
def add_remote():
|
| 36 |
+
"""Añade el remote del Space de Hugging Face"""
|
| 37 |
+
print("🔗 Configurando remote de Hugging Face...")
|
| 38 |
+
|
| 39 |
+
space_url = "https://huggingface.co/spaces/Ntdeseb/test3"
|
| 40 |
+
|
| 41 |
+
# Verificar si el remote ya existe
|
| 42 |
+
success, stdout, stderr = run_command("git remote -v")
|
| 43 |
+
if "huggingface" in stdout or "test3" in stdout:
|
| 44 |
+
print("✅ Remote ya configurado")
|
| 45 |
+
return True
|
| 46 |
+
|
| 47 |
+
# Añadir remote
|
| 48 |
+
success, stdout, stderr = run_command(f"git remote add huggingface {space_url}")
|
| 49 |
+
if success:
|
| 50 |
+
print("✅ Remote añadido correctamente")
|
| 51 |
+
return True
|
| 52 |
+
else:
|
| 53 |
+
print(f"❌ Error añadiendo remote: {stderr}")
|
| 54 |
+
return False
|
| 55 |
+
|
| 56 |
+
def commit_and_push():
|
| 57 |
+
"""Hace commit y push de los cambios"""
|
| 58 |
+
print("📤 Subiendo cambios al Space...")
|
| 59 |
+
|
| 60 |
+
# Añadir todos los archivos
|
| 61 |
+
success, stdout, stderr = run_command("git add .")
|
| 62 |
+
if not success:
|
| 63 |
+
print(f"❌ Error añadiendo archivos: {stderr}")
|
| 64 |
+
return False
|
| 65 |
+
|
| 66 |
+
# Hacer commit
|
| 67 |
+
success, stdout, stderr = run_command('git commit -m "Update VEO3 Free Space configuration"')
|
| 68 |
+
if not success:
|
| 69 |
+
print(f"❌ Error haciendo commit: {stderr}")
|
| 70 |
+
return False
|
| 71 |
+
|
| 72 |
+
# Push al Space
|
| 73 |
+
success, stdout, stderr = run_command("git push huggingface main")
|
| 74 |
+
if success:
|
| 75 |
+
print("✅ Cambios subidos correctamente al Space")
|
| 76 |
+
return True
|
| 77 |
+
else:
|
| 78 |
+
print(f"❌ Error subiendo cambios: {stderr}")
|
| 79 |
+
return False
|
| 80 |
+
|
| 81 |
+
def verify_files():
|
| 82 |
+
"""Verifica que todos los archivos necesarios estén presentes"""
|
| 83 |
+
print("🔍 Verificando archivos necesarios...")
|
| 84 |
+
|
| 85 |
+
required_files = [
|
| 86 |
+
"README.md",
|
| 87 |
+
"app.py",
|
| 88 |
+
"requirements.txt",
|
| 89 |
+
"setup.py",
|
| 90 |
+
"space_config.py",
|
| 91 |
+
".gitignore",
|
| 92 |
+
".gitattributes"
|
| 93 |
+
]
|
| 94 |
+
|
| 95 |
+
missing_files = []
|
| 96 |
+
for file in required_files:
|
| 97 |
+
if not os.path.exists(file):
|
| 98 |
+
missing_files.append(file)
|
| 99 |
+
|
| 100 |
+
if missing_files:
|
| 101 |
+
print(f"❌ Archivos faltantes: {', '.join(missing_files)}")
|
| 102 |
+
return False
|
| 103 |
+
|
| 104 |
+
print("✅ Todos los archivos necesarios están presentes")
|
| 105 |
+
return True
|
| 106 |
+
|
| 107 |
+
def main():
|
| 108 |
+
"""Función principal"""
|
| 109 |
+
print("🚀 Iniciando subida al Space de Hugging Face...")
|
| 110 |
+
print("=" * 60)
|
| 111 |
+
|
| 112 |
+
# Verificar archivos
|
| 113 |
+
if not verify_files():
|
| 114 |
+
print("❌ Faltan archivos necesarios")
|
| 115 |
+
return False
|
| 116 |
+
|
| 117 |
+
# Verificar estado de Git
|
| 118 |
+
if not check_git_status():
|
| 119 |
+
print("❌ Error con Git")
|
| 120 |
+
return False
|
| 121 |
+
|
| 122 |
+
# Añadir remote
|
| 123 |
+
if not add_remote():
|
| 124 |
+
print("❌ Error configurando remote")
|
| 125 |
+
return False
|
| 126 |
+
|
| 127 |
+
# Commit y push
|
| 128 |
+
if not commit_and_push():
|
| 129 |
+
print("❌ Error subiendo cambios")
|
| 130 |
+
return False
|
| 131 |
+
|
| 132 |
+
print("\n🎉 ¡Subida completada exitosamente!")
|
| 133 |
+
print("🌐 Tu Space estará disponible en: https://huggingface.co/spaces/Ntdeseb/test3")
|
| 134 |
+
print("\n📝 Notas importantes:")
|
| 135 |
+
print("- El Space puede tardar 5-10 minutos en iniciar")
|
| 136 |
+
print("- Los modelos se descargarán automáticamente")
|
| 137 |
+
print("- Verifica los logs en la interfaz de Hugging Face")
|
| 138 |
+
|
| 139 |
+
return True
|
| 140 |
+
|
| 141 |
+
if __name__ == "__main__":
|
| 142 |
+
success = main()
|
| 143 |
+
sys.exit(0 if success else 1)
|