VincentGOURBIN commited on
Commit
e700540
·
verified ·
1 Parent(s): 2e1f641

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ LocalRAG HuggingFace Space - Application principale
4
+ Interface Gradio avec support ZeroGPU pour le système RAG complet
5
+ """
6
+
7
+ import os
8
+ import sys
9
+ from pathlib import Path
10
+
11
+ # Configuration ZeroGPU
12
+ os.environ["ZEROGPU_AVAILABLE"] = "1"
13
+
14
+ # Importer le chatbot depuis step03
15
+ try:
16
+ from step03_chatbot import create_gradio_interface, GenericRAGChatbot
17
+ except ImportError as e:
18
+ print(f"❌ Erreur import step03_chatbot: {e}")
19
+ sys.exit(1)
20
+
21
+ def main():
22
+ """Lance l'interface Gradio pour HuggingFace Spaces"""
23
+ print("🚀 LocalRAG - Démarrage du Space HuggingFace")
24
+ print("=" * 50)
25
+
26
+ try:
27
+ # Créer l'interface Gradio avec les optimisations ZeroGPU
28
+ interface = create_gradio_interface()
29
+
30
+ # Lancer avec les paramètres optimisés pour Spaces
31
+ interface.launch(
32
+ share=False, # Pas besoin de tunnel public
33
+ show_error=True # Afficher erreurs pour debug
34
+ )
35
+
36
+ except Exception as e:
37
+ print(f"❌ Erreur lors du lancement: {e}")
38
+ import traceback
39
+ traceback.print_exc()
40
+ sys.exit(1)
41
+
42
+ if __name__ == "__main__":
43
+ main()