Spaces:
Sleeping
Sleeping
Kushagra
commited on
Commit
·
8eaaf5c
1
Parent(s):
31324b8
Moving Cache and module to /tmp directory
Browse files- app/core/models.py +1 -1
- main.py +1 -1
app/core/models.py
CHANGED
@@ -32,7 +32,7 @@ async def load_and_create_vector_store(url: str):
|
|
32 |
Loads a PDF document from a URL and either reuses or builds a FAISS vectorstore.
|
33 |
Returns a retriever object.
|
34 |
"""
|
35 |
-
vectorstore_path = "
|
36 |
|
37 |
if os.path.exists(f"{vectorstore_path}/index.faiss"):
|
38 |
logging.info("Vector store already exists, loading it.")
|
|
|
32 |
Loads a PDF document from a URL and either reuses or builds a FAISS vectorstore.
|
33 |
Returns a retriever object.
|
34 |
"""
|
35 |
+
vectorstore_path = "/tmp/database/faiss_index"
|
36 |
|
37 |
if os.path.exists(f"{vectorstore_path}/index.faiss"):
|
38 |
logging.info("Vector store already exists, loading it.")
|
main.py
CHANGED
@@ -50,7 +50,7 @@ async def process_questions(request: QuestionRequest, api_key: str = Depends(ver
|
|
50 |
logging.info(f"Received {(questions)} questions for processing. Documents URL: {url}")
|
51 |
|
52 |
# Create cache directory if not exists
|
53 |
-
cache_dir = "cache"
|
54 |
os.makedirs(cache_dir, exist_ok=True)
|
55 |
# Create a cache key from url and questions
|
56 |
cache_key = hashlib.sha256((url + json.dumps(questions, sort_keys=True)).encode()).hexdigest()
|
|
|
50 |
logging.info(f"Received {(questions)} questions for processing. Documents URL: {url}")
|
51 |
|
52 |
# Create cache directory if not exists
|
53 |
+
cache_dir = "/tmp/cache"
|
54 |
os.makedirs(cache_dir, exist_ok=True)
|
55 |
# Create a cache key from url and questions
|
56 |
cache_key = hashlib.sha256((url + json.dumps(questions, sort_keys=True)).encode()).hexdigest()
|