Spaces:
Running
Running
Update data_preprocess.py
Browse files- data_preprocess.py +3 -1
data_preprocess.py
CHANGED
|
@@ -543,6 +543,8 @@ def save_text_to_docx(text_content: str, filename: str, drive_folder_id: str):
|
|
| 543 |
"""
|
| 544 |
try:
|
| 545 |
# β
Save to temporary local path first
|
|
|
|
|
|
|
| 546 |
local_path = os.path.join(tempfile.gettempdir(), filename)
|
| 547 |
document = Document()
|
| 548 |
for paragraph_text in text_content.split('\n'):
|
|
@@ -551,7 +553,7 @@ def save_text_to_docx(text_content: str, filename: str, drive_folder_id: str):
|
|
| 551 |
print(f"β
Text saved locally to: {local_path}")
|
| 552 |
|
| 553 |
# β
Upload to Drive
|
| 554 |
-
upload_file_to_drive(local_path, filename, drive_folder_id)
|
| 555 |
print(f"β
Uploaded '{filename}' to Google Drive folder ID: {drive_folder_id}")
|
| 556 |
|
| 557 |
except Exception as e:
|
|
|
|
| 543 |
"""
|
| 544 |
try:
|
| 545 |
# β
Save to temporary local path first
|
| 546 |
+
print("file name: ", filename)
|
| 547 |
+
print("length text content: ", len(text_content))
|
| 548 |
local_path = os.path.join(tempfile.gettempdir(), filename)
|
| 549 |
document = Document()
|
| 550 |
for paragraph_text in text_content.split('\n'):
|
|
|
|
| 553 |
print(f"β
Text saved locally to: {local_path}")
|
| 554 |
|
| 555 |
# β
Upload to Drive
|
| 556 |
+
pipeline.upload_file_to_drive(local_path, filename, drive_folder_id)
|
| 557 |
print(f"β
Uploaded '{filename}' to Google Drive folder ID: {drive_folder_id}")
|
| 558 |
|
| 559 |
except Exception as e:
|