Spaces:
Sleeping
Sleeping
Update pipeline.py
Browse files- pipeline.py +17 -3
pipeline.py
CHANGED
|
@@ -208,8 +208,16 @@ def pipeline_with_gemini(accessions):
|
|
| 208 |
# Define local temp paths for reading/writing
|
| 209 |
import tempfile
|
| 210 |
tmp_dir = tempfile.mkdtemp()
|
| 211 |
-
file_chunk_path = os.path.join(tmp_dir, chunk_filename)
|
| 212 |
-
file_all_path = os.path.join(tmp_dir, all_filename)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
# Try to download if already exists on Drive
|
| 215 |
chunk_exists = download_file_from_drive(chunk_filename, sample_folder_id, file_chunk_path)
|
|
@@ -393,7 +401,13 @@ def pipeline_with_gemini(accessions):
|
|
| 393 |
document_chunks_path = os.path.join(tmp_dir, chunks_filename)
|
| 394 |
structured_lookup_path = os.path.join(tmp_dir, lookup_filename)
|
| 395 |
print("name if faiss path: ", faiss_index_path)
|
| 396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 397 |
download_file_from_drive(faiss_filename, sample_folder_id, faiss_index_path)
|
| 398 |
download_file_from_drive(chunks_filename, sample_folder_id, document_chunks_path)
|
| 399 |
download_file_from_drive(lookup_filename, sample_folder_id, structured_lookup_path)
|
|
|
|
| 208 |
# Define local temp paths for reading/writing
|
| 209 |
import tempfile
|
| 210 |
tmp_dir = tempfile.mkdtemp()
|
| 211 |
+
#file_chunk_path = os.path.join(tmp_dir, chunk_filename)
|
| 212 |
+
#file_all_path = os.path.join(tmp_dir, all_filename)
|
| 213 |
+
file_chunk_path = os.path.join(tempfile.gettempdir(), chunk_filename)
|
| 214 |
+
file_all_path = os.path.join(tempfile.gettempdir(), all_filename)
|
| 215 |
+
|
| 216 |
+
# 🔥 Remove the local file first if it exists
|
| 217 |
+
if os.path.exists(file_chunk_path):
|
| 218 |
+
os.remove(file_chunk_path)
|
| 219 |
+
if os.path.exists(file_all_path):
|
| 220 |
+
os.remove(file_all_path)
|
| 221 |
|
| 222 |
# Try to download if already exists on Drive
|
| 223 |
chunk_exists = download_file_from_drive(chunk_filename, sample_folder_id, file_chunk_path)
|
|
|
|
| 401 |
document_chunks_path = os.path.join(tmp_dir, chunks_filename)
|
| 402 |
structured_lookup_path = os.path.join(tmp_dir, lookup_filename)
|
| 403 |
print("name if faiss path: ", faiss_index_path)
|
| 404 |
+
# 🔥 Remove the local file first if it exists
|
| 405 |
+
if os.path.exists(faiss_index_path):
|
| 406 |
+
os.remove(faiss_index_path)
|
| 407 |
+
if os.path.exists(document_chunks_path):
|
| 408 |
+
os.remove(document_chunks_path)
|
| 409 |
+
if os.path.exists(structured_lookup_path):
|
| 410 |
+
os.remove(structured_lookup_path)
|
| 411 |
download_file_from_drive(faiss_filename, sample_folder_id, faiss_index_path)
|
| 412 |
download_file_from_drive(chunks_filename, sample_folder_id, document_chunks_path)
|
| 413 |
download_file_from_drive(lookup_filename, sample_folder_id, structured_lookup_path)
|