gpt-local / main.py
DRDELATV's picture
Upload folder using huggingface_hub
22ca508 verified
#!/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()