Omnibus commited on
Commit
a2748f6
1 Parent(s): 8049272

Update dl.py

Browse files
Files changed (1) hide show
  1. dl.py +12 -5
dl.py CHANGED
@@ -70,11 +70,15 @@ def show_f(repo,name,token):
70
  img_tog=False
71
  for img in images:
72
  if img in f_name:
 
 
 
 
73
  #html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}"'
74
  #out_text = "Image File"
75
  #https://huggingface.co/spaces/Omnibus/idefics_playground/resolve/main/example_images/cat_sketch.png
76
- sav_im = Image.open(f"https://huggingface.co/spaces/{repo}/{name}/resolve/main/{d_app}")
77
- sav_im.save(f'{name}/{f_name}')
78
  file_list.append(Path(f'{name}/{f_name}'))
79
  #file_out.append(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
80
  img_tog=True
@@ -85,10 +89,13 @@ def show_f(repo,name,token):
85
  print(d_app)
86
  #print (r.text)
87
  uid = uuid.uuid4()
88
-
89
- file = open(f'{name}/{f_name}','w')
90
- file.writelines(r.text)
91
  file.close()
 
 
 
 
92
  file_list.append(Path(f'{name}/{f_name}'))
93
  #file_out.append(d_app)
94
 
 
70
  img_tog=False
71
  for img in images:
72
  if img in f_name:
73
+ url = f"https://huggingface.co/spaces/{repo}/{name}/resolve/main/{d_app}"
74
+ r = requests.get(url)
75
+ with open(f'{name}/{f_name}', "wb") as f:
76
+ f.write(r.content)
77
  #html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}"'
78
  #out_text = "Image File"
79
  #https://huggingface.co/spaces/Omnibus/idefics_playground/resolve/main/example_images/cat_sketch.png
80
+ #sav_im = Image.open(f"https://huggingface.co/spaces/{repo}/{name}/resolve/main/{d_app}")
81
+ #sav_im.save(f'{name}/{f_name}')
82
  file_list.append(Path(f'{name}/{f_name}'))
83
  #file_out.append(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
84
  img_tog=True
 
89
  print(d_app)
90
  #print (r.text)
91
  uid = uuid.uuid4()
92
+ file = open(f'{name}/{f_name}','wb')
93
+ file.write(r.content)
 
94
  file.close()
95
+
96
+ #file = open(f'{name}/{f_name}','w')
97
+ #file.writelines(r.text)
98
+ #file.close()
99
  file_list.append(Path(f'{name}/{f_name}'))
100
  #file_out.append(d_app)
101