Spaces:
Sleeping
Sleeping
Adibvafa
commited on
Commit
·
f1b429f
1
Parent(s):
ad5b346
Clean up API
Browse files
api.py
CHANGED
|
@@ -15,12 +15,10 @@ The API supports:
|
|
| 15 |
|
| 16 |
import uuid
|
| 17 |
import base64
|
| 18 |
-
import asyncio
|
| 19 |
-
import tempfile
|
| 20 |
-
import shutil
|
| 21 |
from pathlib import Path
|
| 22 |
-
from typing import List, Optional, Dict, Any
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
from fastapi import FastAPI, HTTPException, UploadFile, File, Form
|
| 26 |
from fastapi.middleware.cors import CORSMiddleware
|
|
@@ -196,7 +194,6 @@ class MedRAXAPI:
|
|
| 196 |
Returns:
|
| 197 |
QueryResponse: The processed response
|
| 198 |
"""
|
| 199 |
-
import time
|
| 200 |
start_time = time.time()
|
| 201 |
|
| 202 |
# Generate thread ID if not provided
|
|
@@ -320,7 +317,6 @@ class MedRAXAPI:
|
|
| 320 |
for msg in node_output["messages"]:
|
| 321 |
if isinstance(msg, AIMessage) and msg.content:
|
| 322 |
# Clean up temp paths from response
|
| 323 |
-
import re
|
| 324 |
clean_content = re.sub(r"temp[^\s]*", "", msg.content).strip()
|
| 325 |
if clean_content:
|
| 326 |
yield {"type": "text", "content": clean_content}
|
|
|
|
| 15 |
|
| 16 |
import uuid
|
| 17 |
import base64
|
|
|
|
|
|
|
|
|
|
| 18 |
from pathlib import Path
|
| 19 |
+
from typing import List, Optional, Dict, Any
|
| 20 |
+
import re
|
| 21 |
+
import time
|
| 22 |
|
| 23 |
from fastapi import FastAPI, HTTPException, UploadFile, File, Form
|
| 24 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 194 |
Returns:
|
| 195 |
QueryResponse: The processed response
|
| 196 |
"""
|
|
|
|
| 197 |
start_time = time.time()
|
| 198 |
|
| 199 |
# Generate thread ID if not provided
|
|
|
|
| 317 |
for msg in node_output["messages"]:
|
| 318 |
if isinstance(msg, AIMessage) and msg.content:
|
| 319 |
# Clean up temp paths from response
|
|
|
|
| 320 |
clean_content = re.sub(r"temp[^\s]*", "", msg.content).strip()
|
| 321 |
if clean_content:
|
| 322 |
yield {"type": "text", "content": clean_content}
|