File size: 1,070 Bytes
783d70f 016b195 783d70f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import gradio as gr
import os
import logging
from modules.auth.auth import create_auth_interface
from modules.database.database_init import initialize_database_connections
import spaces
import torch
zero = torch.Tensor([0]).cuda()
print(zero.device) # <-- 'cpu' 馃
@spaces.GPU
def greet(n):
print(zero.device) # <-- 'cuda:0' 馃
return f"Hello {zero + n} Tensor"
# Configuraci贸n b谩sica
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Verificar variables de entorno
COSMOS_ENDPOINT = os.getenv("COSMOS_ENDPOINT")
COSMOS_KEY = os.getenv("COSMOS_KEY")
if not COSMOS_ENDPOINT or not COSMOS_KEY:
raise ValueError("Faltan variables de entorno: COSMOS_ENDPOINT y COSMOS_KEY.")
# Inicializar la conexi贸n a la base de datos
if not initialize_database_connections():
raise ValueError("No se pudo inicializar la conexi贸n a la base de datos.")
# Crear la interfaz de login
app = create_auth_interface()
# Lanzar la aplicaci贸n
if __name__ == "__main__":
app.launch(server_name="0.0.0.0", server_port=7860, auth=None)
|