Spaces:
Paused
Paused
Update dl.py
Browse files
dl.py
CHANGED
|
@@ -118,15 +118,21 @@ def show_f2(repo,name,token):
|
|
| 118 |
def show_f_cont(repo,name,file,token):
|
| 119 |
html_text = '<html>\n<body>\n<div>\n'
|
| 120 |
images=[".png" , ".jpg" , ".gif" , ".webm" , ".mp4"]
|
|
|
|
| 121 |
for x in images:
|
| 122 |
if x in file:
|
| 123 |
html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/resolve/main/{file}" style="width:100%;font-size:small;"></object>'
|
| 124 |
out_text = "Image File"
|
|
|
|
| 125 |
else:
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
html_text += '</div>\n</body>\n</html>'
|
| 131 |
return(html_text,out_text)
|
| 132 |
|
|
|
|
| 118 |
def show_f_cont(repo,name,file,token):
|
| 119 |
html_text = '<html>\n<body>\n<div>\n'
|
| 120 |
images=[".png" , ".jpg" , ".gif" , ".webm" , ".mp4"]
|
| 121 |
+
is_im=False
|
| 122 |
for x in images:
|
| 123 |
if x in file:
|
| 124 |
html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/resolve/main/{file}" style="width:100%;font-size:small;"></object>'
|
| 125 |
out_text = "Image File"
|
| 126 |
+
is_im=True
|
| 127 |
else:
|
| 128 |
+
pass
|
| 129 |
+
if is_im==False:
|
| 130 |
+
r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}')
|
| 131 |
+
text=r.text
|
| 132 |
+
html_text += f'<pre style="text-wrap:pretty;">{text}</pre>\n'
|
| 133 |
+
out_text = r.text
|
| 134 |
+
else:
|
| 135 |
+
pass
|
| 136 |
html_text += '</div>\n</body>\n</html>'
|
| 137 |
return(html_text,out_text)
|
| 138 |
|