Spaces:
Sleeping
Sleeping
Update player.py
Browse files
player.py
CHANGED
@@ -68,18 +68,21 @@ def load_vid(channel):
|
|
68 |
|
69 |
|
70 |
def show_vid(vid_file,list_hid):
|
|
|
|
|
|
|
71 |
label_html=""
|
72 |
#vid_slug=vid_file.split("videos/",1)[1].split(".",1)[0]
|
73 |
|
74 |
label_html=f'''{label_html}
|
75 |
-
<video src="https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/{
|
76 |
</video>'''
|
77 |
return label_html
|
78 |
|
79 |
##############################################
|
80 |
|
81 |
-
def build_space(t_space,t_title,t_description=None,t_name=None,t_redirect=None,t_image=None,t_image_url=None,token=None):
|
82 |
-
|
83 |
|
84 |
|
85 |
|
@@ -181,7 +184,7 @@ def build_space(t_space,t_title,t_description=None,t_name=None,t_redirect=None,t
|
|
181 |
t_link = f"https://{repo_name.replace('/','-').replace('_','-')}.static.hf.space/ai.html"
|
182 |
|
183 |
########## norm
|
184 |
-
with open("
|
185 |
app = f.read()
|
186 |
app = app.replace("$space", t_space)
|
187 |
app = app.replace("$title", t_title)
|
@@ -194,7 +197,7 @@ def build_space(t_space,t_title,t_description=None,t_name=None,t_redirect=None,t
|
|
194 |
|
195 |
api.upload_file(
|
196 |
path_or_fileobj="ai.html",
|
197 |
-
path_in_repo="
|
198 |
repo_id=repo_name,
|
199 |
token=token,
|
200 |
repo_type="space",
|
|
|
68 |
|
69 |
|
70 |
def show_vid(vid_file,list_hid):
|
71 |
+
vid_list=[]
|
72 |
+
for i,ea in enumerate(list_hid):
|
73 |
+
vid_list.append(ea)
|
74 |
label_html=""
|
75 |
#vid_slug=vid_file.split("videos/",1)[1].split(".",1)[0]
|
76 |
|
77 |
label_html=f'''{label_html}
|
78 |
+
<video src="https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/{vid_list[int(vid_file)]}" controls>
|
79 |
</video>'''
|
80 |
return label_html
|
81 |
|
82 |
##############################################
|
83 |
|
84 |
+
#def build_space(t_space,t_title,t_description=None,t_name=None,t_redirect=None,t_image=None,t_image_url=None,token=None):
|
85 |
+
def build_space(vid_file):
|
86 |
|
87 |
|
88 |
|
|
|
184 |
t_link = f"https://{repo_name.replace('/','-').replace('_','-')}.static.hf.space/ai.html"
|
185 |
|
186 |
########## norm
|
187 |
+
with open("template_front.html", "r") as f:
|
188 |
app = f.read()
|
189 |
app = app.replace("$space", t_space)
|
190 |
app = app.replace("$title", t_title)
|
|
|
197 |
|
198 |
api.upload_file(
|
199 |
path_or_fileobj="ai.html",
|
200 |
+
path_in_repo="index.html",
|
201 |
repo_id=repo_name,
|
202 |
token=token,
|
203 |
repo_type="space",
|