Spaces:
Sleeping
Sleeping
Update dl.py
Browse files
dl.py
CHANGED
@@ -118,15 +118,18 @@ def show_f2(repo,name,token):
|
|
118 |
|
119 |
|
120 |
def show_f_cont(repo,name,file,token):
|
121 |
-
r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}')
|
122 |
-
text=r.text
|
123 |
html_text = '<html>\n<body>\n'
|
124 |
-
|
125 |
-
#for line in text.split('\n'):
|
126 |
-
html_text += f'<pre>{text}</pre>\n'
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
html_text += '</body>\n</html>'
|
129 |
-
return(html_text,
|
130 |
|
131 |
|
132 |
|
|
|
118 |
|
119 |
|
120 |
def show_f_cont(repo,name,file,token):
|
|
|
|
|
121 |
html_text = '<html>\n<body>\n'
|
|
|
|
|
|
|
122 |
|
123 |
+
if ".png" or ".jpg" or ".gif" or ".webm" or ".mp4" in file:
|
124 |
+
html_text += f'<object data="https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}"'
|
125 |
+
out_text = "Image File"
|
126 |
+
else:
|
127 |
+
r = requests.get(f'https://huggingface.co/spaces/{repo}/{name}/raw/main/{file}')
|
128 |
+
text=r.text
|
129 |
+
html_text += f'<pre>{text}</pre>\n'
|
130 |
+
out_text = r.text
|
131 |
html_text += '</body>\n</html>'
|
132 |
+
return(html_text,out_text)
|
133 |
|
134 |
|
135 |
|