Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,10 +63,10 @@ async def lifespan(app: FastAPI):
|
|
| 63 |
if not GOOGLE_API_KEY:
|
| 64 |
raise RuntimeError("CRITICAL: Missing GOOGLE_API_KEY in environment secrets!")
|
| 65 |
nvidia_api_key = os.getenv("nvidia_api_key")
|
| 66 |
-
print("🔑
|
| 67 |
|
| 68 |
if not nvidia_api_key:
|
| 69 |
-
raise RuntimeError("CRITICAL: Missing
|
| 70 |
|
| 71 |
# Load models into the shared dictionary
|
| 72 |
ml_models["embedder"] = HuggingFaceEmbeddings(
|
|
@@ -162,7 +162,7 @@ async def run_hackrx(req: RunRequest):
|
|
| 162 |
if not chunks:
|
| 163 |
return JSONResponse({"error": "No documents could be processed."}, status_code=400)
|
| 164 |
start_time2 = time.time()
|
| 165 |
-
vectorstore = await FAISS.
|
| 166 |
documents=chunks,
|
| 167 |
embedding=ml_models["embedder"]
|
| 168 |
)
|
|
|
|
| 63 |
if not GOOGLE_API_KEY:
|
| 64 |
raise RuntimeError("CRITICAL: Missing GOOGLE_API_KEY in environment secrets!")
|
| 65 |
nvidia_api_key = os.getenv("nvidia_api_key")
|
| 66 |
+
print("🔑 nvidia:", "FOUND" if nvidia_api_key else "NOT FOUND")
|
| 67 |
|
| 68 |
if not nvidia_api_key:
|
| 69 |
+
raise RuntimeError("CRITICAL: Missing nvidia api key in environment secrets!")
|
| 70 |
|
| 71 |
# Load models into the shared dictionary
|
| 72 |
ml_models["embedder"] = HuggingFaceEmbeddings(
|
|
|
|
| 162 |
if not chunks:
|
| 163 |
return JSONResponse({"error": "No documents could be processed."}, status_code=400)
|
| 164 |
start_time2 = time.time()
|
| 165 |
+
vectorstore = await FAISS.from_documents(
|
| 166 |
documents=chunks,
|
| 167 |
embedding=ml_models["embedder"]
|
| 168 |
)
|