Spaces:
Running
Running
Add diagnostics and disable SSR mode
Browse files
app.py
CHANGED
|
@@ -1,16 +1,39 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
from rag_core.
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
DEFAULT_COLLECTION = os.getenv("DEFAULT_COLLECTION", "hackathon")
|
| 16 |
|
|
@@ -80,4 +103,4 @@ with gr.Blocks() as demo:
|
|
| 80 |
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
| 83 |
-
demo.launch()
|
|
|
|
| 1 |
import os
|
| 2 |
+
import sys
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
+
print("π Starting RAG-MCP Agent...", file=sys.stderr)
|
| 6 |
+
|
| 7 |
+
try:
|
| 8 |
+
from rag_core.config import get_config
|
| 9 |
+
print("β Config loaded", file=sys.stderr)
|
| 10 |
+
|
| 11 |
+
from rag_core.model import Model
|
| 12 |
+
print("β Model module loaded", file=sys.stderr)
|
| 13 |
+
|
| 14 |
+
from rag_core.vector_store import QdrantVectorStore
|
| 15 |
+
print("β VectorStore module loaded", file=sys.stderr)
|
| 16 |
+
|
| 17 |
+
from rag_core.search import RagService
|
| 18 |
+
print("β RagService module loaded", file=sys.stderr)
|
| 19 |
+
|
| 20 |
+
cfg = get_config()
|
| 21 |
+
print(f"β Config initialized: vector_store={cfg.vector_store}, model={cfg.model_name}", file=sys.stderr)
|
| 22 |
+
|
| 23 |
+
model = Model(model_name=cfg.model_name)
|
| 24 |
+
print("β Model initialized", file=sys.stderr)
|
| 25 |
+
|
| 26 |
+
store = QdrantVectorStore.from_config(cfg)
|
| 27 |
+
print("β VectorStore initialized", file=sys.stderr)
|
| 28 |
+
|
| 29 |
+
rag = RagService(model=model, vector_store=store, config=cfg)
|
| 30 |
+
print("β RagService initialized", file=sys.stderr)
|
| 31 |
+
|
| 32 |
+
except Exception as e:
|
| 33 |
+
print(f"β Error during initialization: {e}", file=sys.stderr)
|
| 34 |
+
import traceback
|
| 35 |
+
traceback.print_exc()
|
| 36 |
+
raise
|
| 37 |
|
| 38 |
DEFAULT_COLLECTION = os.getenv("DEFAULT_COLLECTION", "hackathon")
|
| 39 |
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
| 106 |
+
demo.launch(ssr_mode=False)
|