Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import os
|
| 3 |
import json
|
| 4 |
import re
|
|
|
|
| 5 |
import asyncio
|
| 6 |
from contextlib import asynccontextmanager
|
| 7 |
from dotenv import load_dotenv
|
|
@@ -153,8 +154,11 @@ def parse_llm_response(content: str) -> str:
|
|
| 153 |
# --- 5. Main API Endpoint ---
|
| 154 |
@app.post("/api/v1/hackrx/run", response_model=RunResponse, dependencies=[Depends(verify_api_key)])
|
| 155 |
async def run_hackrx(req: RunRequest):
|
|
|
|
|
|
|
| 156 |
chunks = load_and_chunk(str(req.documents))
|
| 157 |
-
|
|
|
|
| 158 |
if not chunks:
|
| 159 |
return JSONResponse({"error": "No documents could be processed."}, status_code=400)
|
| 160 |
|
|
|
|
| 2 |
import os
|
| 3 |
import json
|
| 4 |
import re
|
| 5 |
+
import time
|
| 6 |
import asyncio
|
| 7 |
from contextlib import asynccontextmanager
|
| 8 |
from dotenv import load_dotenv
|
|
|
|
| 154 |
# --- 5. Main API Endpoint ---
|
| 155 |
@app.post("/api/v1/hackrx/run", response_model=RunResponse, dependencies=[Depends(verify_api_key)])
|
| 156 |
async def run_hackrx(req: RunRequest):
|
| 157 |
+
|
| 158 |
+
start_time = time.time()
|
| 159 |
chunks = load_and_chunk(str(req.documents))
|
| 160 |
+
end_time = time.time() - start_time
|
| 161 |
+
print(f"chunking done: {end_time}")
|
| 162 |
if not chunks:
|
| 163 |
return JSONResponse({"error": "No documents could be processed."}, status_code=400)
|
| 164 |
|