#!/usr/bin/env python3 """ LocalRAG HuggingFace Space - Application principale Interface Gradio avec support ZeroGPU pour le système RAG complet """ import os import sys from pathlib import Path # Configuration ZeroGPU os.environ["ZEROGPU_AVAILABLE"] = "1" # Importer le chatbot depuis step03 try: from step03_chatbot import create_gradio_interface, GenericRAGChatbot except ImportError as e: print(f"❌ Erreur import step03_chatbot: {e}") sys.exit(1) def main(): """Lance l'interface Gradio pour HuggingFace Spaces""" print("🚀 LocalRAG - Démarrage du Space HuggingFace") print("=" * 50) try: # Créer l'interface Gradio avec les optimisations ZeroGPU interface = create_gradio_interface() # Lancer avec les paramètres optimisés pour Spaces interface.launch( share=False, # Pas besoin de tunnel public show_error=True, # Afficher erreurs pour debug ssr_mode=False # Désactiver SSR expérimental pour éviter erreurs ContextVar ) except Exception as e: print(f"❌ Erreur lors du lancement: {e}") import traceback traceback.print_exc() sys.exit(1) if __name__ == "__main__": main()