File size: 1,387 Bytes
22ca508
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
GPT Local - Aplicación principal
Ejecuta el GPT de texto local con interfaz web
"""

import sys
import logging
from pathlib import Path

# Agregar el directorio raíz al path
sys.path.append(str(Path(__file__).parent))

from ui.gradio_interface import GradioInterface
from config.settings import WEB_CONFIG, LOGGING_CONFIG

def setup_logging():
    """Configurar el sistema de logging"""
    logging.basicConfig(
        level=getattr(logging, LOGGING_CONFIG["level"]),
        format=LOGGING_CONFIG["format"]
    )

def main():
    """Función principal"""
    # Configurar logging
    setup_logging()
    logger = logging.getLogger(__name__)
    
    logger.info("🚀 Iniciando GPT Local...")
    logger.info(f"Configuración: {WEB_CONFIG}")
    
    try:
        # Crear e iniciar la interfaz
        interface = GradioInterface()
        
        logger.info("🌐 Lanzando interfaz web...")
        interface.launch(
            server_name=WEB_CONFIG["host"],
            server_port=WEB_CONFIG["port"],
            share=WEB_CONFIG["share"],
            debug=WEB_CONFIG["debug"]
        )
        
    except KeyboardInterrupt:
        logger.info("👋 Aplicación detenida por el usuario")
    except Exception as e:
        logger.error(f"❌ Error al ejecutar la aplicación: {str(e)}")
        sys.exit(1)

if __name__ == "__main__":
    main()