Spaces:
Paused
Paused
Update dl.py
Browse files
dl.py
CHANGED
|
@@ -37,14 +37,34 @@ def show_f(repo,name,token):
|
|
| 37 |
os.makedirs(name)
|
| 38 |
|
| 39 |
for d_app in f_ist:
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}')
|
|
|
|
|
|
|
| 42 |
#print (r.text)
|
| 43 |
uid = uuid.uuid4()
|
| 44 |
|
| 45 |
-
|
| 46 |
-
pf=d_app.split(".",1)[0]
|
| 47 |
-
f_name=f'{pf}.{sf}'
|
| 48 |
file = open(f'{name}/{f_name}','w')
|
| 49 |
file.writelines(r.text)
|
| 50 |
file.close()
|
|
|
|
| 37 |
os.makedirs(name)
|
| 38 |
|
| 39 |
for d_app in f_ist:
|
| 40 |
+
if "/" in d_app:
|
| 41 |
+
dir_1=d_app.split("/",1)[0]
|
| 42 |
+
rem_1=d_app.split("/",1)[1]
|
| 43 |
+
if not os.path.exists(f'{name}/{dir_1}'):
|
| 44 |
+
os.makedirs(f'{name}/{dir_1}')
|
| 45 |
+
|
| 46 |
+
if "/" in rem_1:
|
| 47 |
+
dir_2=rem_1.split("/",1)[0]
|
| 48 |
+
rem_2=rem_1.split("/",1)[1]
|
| 49 |
+
if not os.path.exists(f'{name}/{dir_1}/{dir_2}'):
|
| 50 |
+
os.makedirs(f'{name}/{dir_1}/{dir_2}')
|
| 51 |
+
sf=rem_2.split(".",1)[1]
|
| 52 |
+
pf=rem_2.split(".",1)[0]
|
| 53 |
+
f_name=f'{dir_1}/{dir2}/{pf}.{sf}'
|
| 54 |
+
|
| 55 |
+
else:
|
| 56 |
+
sf=rem_1.split(".",1)[1]
|
| 57 |
+
pf=rem_1.split(".",1)[0]
|
| 58 |
+
f_name=f'{dir_1}/{pf}.{sf}'
|
| 59 |
+
else:
|
| 60 |
+
pass
|
| 61 |
r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}')
|
| 62 |
+
print(f_name)
|
| 63 |
+
print(d_app)
|
| 64 |
#print (r.text)
|
| 65 |
uid = uuid.uuid4()
|
| 66 |
|
| 67 |
+
|
|
|
|
|
|
|
| 68 |
file = open(f'{name}/{f_name}','w')
|
| 69 |
file.writelines(r.text)
|
| 70 |
file.close()
|