VyLala commited on
Commit
1d9a663
·
verified ·
1 Parent(s): 0f45c46

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +12 -2
pipeline.py CHANGED
@@ -202,8 +202,15 @@ def pipeline_with_gemini(accessions):
202
  sample_folder_id = get_or_create_drive_folder(str(id), parent_id=data_folder_id)
203
 
204
  # Define document names
205
- chunk_filename = f"{saveTitle}_merged_document.docx"
206
- all_filename = f"{saveTitle}_all_merged_document.docx"
 
 
 
 
 
 
 
207
  print(chunk_filename, all_filename)
208
  # Define local temp paths for reading/writing
209
  import tempfile
@@ -215,8 +222,11 @@ def pipeline_with_gemini(accessions):
215
  print(file_chunk_path)
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
  print("chunk exist: ", chunk_exists)
222
  # Try to download if already exists on Drive
 
202
  sample_folder_id = get_or_create_drive_folder(str(id), parent_id=data_folder_id)
203
 
204
  # Define document names
205
+ if len(saveTitle) > 50:
206
+ saveName = saveTitle[:50]
207
+ saveName = saveName.replace(" ", "_")
208
+ chunk_filename = f"{saveName}_merged_document.docx"
209
+ all_filename = f"{saveName}_all_merged_document.docx"
210
+ else:
211
+ saveName = saveTitle.replace(" ", "_")
212
+ chunk_filename = f"{saveName}_merged_document.docx"
213
+ all_filename = f"{saveName}_all_merged_document.docx"
214
  print(chunk_filename, all_filename)
215
  # Define local temp paths for reading/writing
216
  import tempfile
 
222
  print(file_chunk_path)
223
  # 🔥 Remove the local file first if it exists
224
  if os.path.exists(file_chunk_path):
225
+ print("here 1")
226
  os.remove(file_chunk_path)
227
+ print("here 2")
228
  if os.path.exists(file_all_path):
229
+ print("here 3")
230
  os.remove(file_all_path)
231
  print("chunk exist: ", chunk_exists)
232
  # Try to download if already exists on Drive