Spaces:
Sleeping
Sleeping
pragnakalp
commited on
Commit
•
d8d40de
1
Parent(s):
9a7c6fb
Update save_data.py
Browse files- save_data.py +15 -13
save_data.py
CHANGED
@@ -21,21 +21,23 @@ REPOSITORY_DIR = "data"
|
|
21 |
LOCAL_DIR = 'data_local'
|
22 |
os.makedirs(LOCAL_DIR,exist_ok=True)
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
39 |
# repo = Repository(local_dir="ocr_data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
|
40 |
# repo.git_pull()
|
41 |
|
|
|
21 |
LOCAL_DIR = 'data_local'
|
22 |
os.makedirs(LOCAL_DIR,exist_ok=True)
|
23 |
|
24 |
+
try:
|
25 |
+
hf_hub_download(
|
26 |
+
repo_id=DATASET_REPO_ID,
|
27 |
+
filename=DATA_FILENAME,
|
28 |
+
cache_dir=DATA_DIRNAME,
|
29 |
+
force_filename=DATA_FILENAME
|
30 |
+
)
|
31 |
|
32 |
+
except:
|
33 |
+
print("file not found")
|
34 |
|
35 |
+
try:
|
36 |
+
repo = Repository(local_dir="ocr_data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
|
37 |
+
repo.git_pull()
|
38 |
+
except Exception as e:
|
39 |
+
print("Error occurred during git pull:", e)
|
40 |
+
|
41 |
# repo = Repository(local_dir="ocr_data", clone_from=DATASET_REPO_URL, use_auth_token=HF_TOKEN)
|
42 |
# repo.git_pull()
|
43 |
|