Commit
·
7eab692
1
Parent(s):
f19f22f
Update app.py
Browse files
app.py
CHANGED
@@ -14,11 +14,27 @@ from hfserver import HuggingFaceDatasetSaver, HuggingFaceDatasetJSONSaver
|
|
14 |
|
15 |
LOAD_DATA_GOOGLE_DRIVE = True
|
16 |
if LOAD_DATA_GOOGLE_DRIVE: # download data from google drive
|
17 |
-
url = 'https://drive.google.com/drive/folders/1JuNQS4R7axTezWj1x4KRAuRt_L26ApxA?usp=sharing' # './processed/' folder in google drive
|
|
|
18 |
output = './'
|
19 |
id = url.split('/')[-1]
|
20 |
os.system(f"gdown --id {id} -O {output} --folder --no-cookies --remaining-ok")
|
21 |
-
VIDEO_PATH = '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
else: # local data
|
23 |
VIDEO_PATH = 'robotinder-data'
|
24 |
|
|
|
14 |
|
15 |
LOAD_DATA_GOOGLE_DRIVE = True
|
16 |
if LOAD_DATA_GOOGLE_DRIVE: # download data from google drive
|
17 |
+
# url = 'https://drive.google.com/drive/folders/1JuNQS4R7axTezWj1x4KRAuRt_L26ApxA?usp=sharing' # './processed/' folder in google drive
|
18 |
+
url = 'https://drive.google.com/drive/folders/1WWOzM9T4HUvuB6gUYPqIEOb_aZwUULNA?usp=sharing' # './processed_zip/' folder in google drive
|
19 |
output = './'
|
20 |
id = url.split('/')[-1]
|
21 |
os.system(f"gdown --id {id} -O {output} --folder --no-cookies --remaining-ok")
|
22 |
+
VIDEO_PATH = 'processed_zip'
|
23 |
+
|
24 |
+
import zipfile
|
25 |
+
from os import listdir
|
26 |
+
from os.path import isfile, join, isdir
|
27 |
+
# unzip the zip files to the same location and delete zip files
|
28 |
+
path_to_zip_file = VIDEO_PATH
|
29 |
+
zip_files = [join(path_to_zip_file, f) for f in listdir(path_to_zip_file)]
|
30 |
+
for f in zip_files:
|
31 |
+
if f.endswith(".zip"):
|
32 |
+
directory_to_extract_to = f.replace('.zip', '')
|
33 |
+
print(f'extract data {f} to {directory_to_extract_to}')
|
34 |
+
with zipfile.ZipFile(f, 'r') as zip_ref:
|
35 |
+
zip_ref.extractall(directory_to_extract_to)
|
36 |
+
os.remove(f)
|
37 |
+
|
38 |
else: # local data
|
39 |
VIDEO_PATH = 'robotinder-data'
|
40 |
|