Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -15,13 +15,13 @@ def update_db_hub(texts, topics, dates):
|
|
15 |
"topic": topics,
|
16 |
"date": dates
|
17 |
}
|
18 |
-
print("new_rows", new_rows)
|
19 |
new_dataset = Dataset.from_dict(new_rows)
|
20 |
|
21 |
try:
|
22 |
# Load the dataset (use_auth_token=True if it's private)
|
23 |
dataset = load_dataset(dataset_name, download_config=DownloadConfig(token=api_token))
|
24 |
-
print("Dataset loaded successfully!", dataset)
|
25 |
# print(dataset)
|
26 |
updated_dataset = concatenate_datasets([dataset['train'], new_dataset])
|
27 |
except Exception as e:
|
@@ -34,7 +34,7 @@ def update_db_hub(texts, topics, dates):
|
|
34 |
print("updated_dataset", updated_dataset)
|
35 |
# Push the updated dataset back to the hub
|
36 |
try:
|
37 |
-
updated_dataset.push_to_hub(dataset_name, private=
|
38 |
print(f"Updated dataset pushed to the Hugging Face Hub: {dataset_name}")
|
39 |
except Exception as e:
|
40 |
print(f"Failed to push dataset: {e}")
|
|
|
15 |
"topic": topics,
|
16 |
"date": dates
|
17 |
}
|
18 |
+
# print("new_rows", new_rows)
|
19 |
new_dataset = Dataset.from_dict(new_rows)
|
20 |
|
21 |
try:
|
22 |
# Load the dataset (use_auth_token=True if it's private)
|
23 |
dataset = load_dataset(dataset_name, download_config=DownloadConfig(token=api_token))
|
24 |
+
# print("Dataset loaded successfully!", dataset)
|
25 |
# print(dataset)
|
26 |
updated_dataset = concatenate_datasets([dataset['train'], new_dataset])
|
27 |
except Exception as e:
|
|
|
34 |
print("updated_dataset", updated_dataset)
|
35 |
# Push the updated dataset back to the hub
|
36 |
try:
|
37 |
+
updated_dataset.push_to_hub(dataset_name, private=True) # Set private=False if it's not private
|
38 |
print(f"Updated dataset pushed to the Hugging Face Hub: {dataset_name}")
|
39 |
except Exception as e:
|
40 |
print(f"Failed to push dataset: {e}")
|