Omnibus commited on
Commit
aa4a811
1 Parent(s): 5ce6b45

Update dl.py

Browse files
Files changed (1) hide show
  1. dl.py +3 -7
dl.py CHANGED
@@ -36,7 +36,7 @@ def show_f(repo,name,token):
36
  #file_out = []
37
  if not os.path.exists(name):
38
  os.makedirs(name)
39
-
40
  for d_app in f_ist:
41
  if "/" in d_app:
42
  dir_1=d_app.split("/",1)[0]
@@ -67,17 +67,13 @@ def show_f(repo,name,token):
67
  pass
68
 
69
 
70
-
71
- if ".png" or ".jpg" or ".gif" or ".webm" or ".mp4" in f_name:
72
  #html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}"'
73
  #out_text = "Image File"
74
  sav_im = Image.open(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
75
  sav_im.save(f'{name}/{f_name}')
76
  file_list.append(Path(f'{name}/{f_name}'))
77
  #file_out.append(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
78
-
79
-
80
-
81
  else:
82
  r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}')
83
  print(d_app)
@@ -135,7 +131,7 @@ def show_f2(repo,name,token):
135
  def show_f_cont(repo,name,file,token):
136
  html_text = '<html>\n<body>\n'
137
 
138
- if ".png" or ".jpg" or ".gif" or ".webm" or ".mp4" in file:
139
  html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}"'
140
  out_text = "Image File"
141
  else:
 
36
  #file_out = []
37
  if not os.path.exists(name):
38
  os.makedirs(name)
39
+ images = [".png" , ".jpg" , ".gif" , ".webm" , ".mp4"]
40
  for d_app in f_ist:
41
  if "/" in d_app:
42
  dir_1=d_app.split("/",1)[0]
 
67
  pass
68
 
69
 
70
+ if (img for img in images) in f_name:
 
71
  #html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}"'
72
  #out_text = "Image File"
73
  sav_im = Image.open(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
74
  sav_im.save(f'{name}/{f_name}')
75
  file_list.append(Path(f'{name}/{f_name}'))
76
  #file_out.append(f"https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}")
 
 
 
77
  else:
78
  r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{d_app}')
79
  print(d_app)
 
131
  def show_f_cont(repo,name,file,token):
132
  html_text = '<html>\n<body>\n'
133
 
134
+ if (".png" or ".jpg" or ".gif" or ".webm" or ".mp4") in file:
135
  html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}"'
136
  out_text = "Image File"
137
  else: