Spaces:
Sleeping
Sleeping
Commit
·
a9e55b8
1
Parent(s):
dc023a7
Resolved CorsError 3
Browse files
api.py
CHANGED
@@ -5,6 +5,7 @@ from typing import List, Optional
|
|
5 |
import numpy as np
|
6 |
import io
|
7 |
import os
|
|
|
8 |
from dotenv import load_dotenv
|
9 |
from pydub import AudioSegment
|
10 |
from utils import (
|
@@ -66,6 +67,12 @@ async def upload(files: List[UploadFile] = File(...)):
|
|
66 |
headers=headers
|
67 |
)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
print("Starting document processing...")
|
70 |
raw_docs = load_documents_gradio(files)
|
71 |
print("Documents loaded. Splitting documents...")
|
|
|
5 |
import numpy as np
|
6 |
import io
|
7 |
import os
|
8 |
+
import gc
|
9 |
from dotenv import load_dotenv
|
10 |
from pydub import AudioSegment
|
11 |
from utils import (
|
|
|
67 |
headers=headers
|
68 |
)
|
69 |
|
70 |
+
# Explicitly clear memory before processing new files
|
71 |
+
print("Clearing previous vector store from memory...")
|
72 |
+
store["value"] = None
|
73 |
+
gc.collect()
|
74 |
+
print("Memory cleared.")
|
75 |
+
|
76 |
print("Starting document processing...")
|
77 |
raw_docs = load_documents_gradio(files)
|
78 |
print("Documents loaded. Splitting documents...")
|