Spaces:
Running
on
Zero
Running
on
Zero
File size: 1,290 Bytes
e700540 875c265 e700540 |
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 |
#!/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()
|