|
|
|
""" |
|
GPT Local - Aplicación principal |
|
Ejecuta el GPT de texto local con interfaz web |
|
""" |
|
|
|
import sys |
|
import logging |
|
from pathlib import 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""" |
|
|
|
setup_logging() |
|
logger = logging.getLogger(__name__) |
|
|
|
logger.info("🚀 Iniciando GPT Local...") |
|
logger.info(f"Configuración: {WEB_CONFIG}") |
|
|
|
try: |
|
|
|
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() |
|
|