Commit
•
1b56724
1
Parent(s):
e014498
Get dataset abstraction
Browse files
main.py
CHANGED
@@ -92,15 +92,7 @@ def run_main_continuously():
|
|
92 |
# Calculate the start time for running the main_function every day.
|
93 |
start_time = datetime.now().time()
|
94 |
|
95 |
-
|
96 |
-
try:
|
97 |
-
dataset = load_dataset(dataset_name, download_mode="reuse_cache_if_exists", ignore_verifications=True)
|
98 |
-
logger.debug("Loading existing dataset")
|
99 |
-
if "__index_level_0__" in dataset["all_days"].column_names:
|
100 |
-
dataset = dataset.remove_columns(["__index_level_0__"])
|
101 |
-
except FileNotFoundError:
|
102 |
-
logger.warning("Creating new dataset")
|
103 |
-
dataset = DatasetDict()
|
104 |
|
105 |
while True:
|
106 |
today = datetime.now().date()
|
@@ -119,5 +111,18 @@ def run_main_continuously():
|
|
119 |
time.sleep(wait_until_tomorrow)
|
120 |
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
if __name__ == '__main__':
|
123 |
run_main_continuously()
|
|
|
92 |
# Calculate the start time for running the main_function every day.
|
93 |
start_time = datetime.now().time()
|
94 |
|
95 |
+
dataset = get_dataset()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
while True:
|
98 |
today = datetime.now().date()
|
|
|
111 |
time.sleep(wait_until_tomorrow)
|
112 |
|
113 |
|
114 |
+
def get_dataset():
|
115 |
+
# Load the existing dataset from the Hugging Face hub or create a new one
|
116 |
+
try:
|
117 |
+
dataset = load_dataset(dataset_name, download_mode="reuse_cache_if_exists", ignore_verifications=True)
|
118 |
+
logger.debug("Loading existing dataset")
|
119 |
+
if "__index_level_0__" in dataset["all_days"].column_names:
|
120 |
+
dataset = dataset.remove_columns(["__index_level_0__"])
|
121 |
+
except FileNotFoundError:
|
122 |
+
logger.warning("Creating new dataset")
|
123 |
+
dataset = DatasetDict()
|
124 |
+
return dataset
|
125 |
+
|
126 |
+
|
127 |
if __name__ == '__main__':
|
128 |
run_main_continuously()
|