Spaces:
Sleeping
Sleeping
Update player.py
Browse files
player.py
CHANGED
@@ -23,7 +23,6 @@ def load_vid(channel):
|
|
23 |
out_html=""
|
24 |
label_html=""
|
25 |
vid_list=[]
|
26 |
-
sync_list
|
27 |
try:
|
28 |
file_box = [info.path for info in list_files_info(f'{channel}', repo_type="dataset")]
|
29 |
ai_tube_box = [info.path for info in list_files_info(f'{source_dataset}', repo_type="dataset")]
|
@@ -64,15 +63,15 @@ def load_vid(channel):
|
|
64 |
pass
|
65 |
except Exception as e:
|
66 |
print(e)
|
67 |
-
return(out_html,gr.Dropdown(label="Videos", choices=[s for s in vid_list],interactive=True))
|
68 |
|
69 |
|
70 |
-
def show_vid(vid_file):
|
71 |
|
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/{vid_file}" controls>
|
76 |
</video>'''
|
77 |
return label_html
|
78 |
|
@@ -125,9 +124,10 @@ with gr.Blocks() as app:
|
|
125 |
button = gr.Button()
|
126 |
output = gr.HTML()
|
127 |
label_output = gr.HTML()
|
|
|
128 |
|
129 |
app.load(find_dataset,None,channel)
|
130 |
-
channel.change(load_vid,channel,[output,videos])
|
131 |
-
videos.change(show_vid,videos,[label_output])
|
132 |
|
133 |
app.launch(show_api=False,share=False)
|
|
|
23 |
out_html=""
|
24 |
label_html=""
|
25 |
vid_list=[]
|
|
|
26 |
try:
|
27 |
file_box = [info.path for info in list_files_info(f'{channel}', repo_type="dataset")]
|
28 |
ai_tube_box = [info.path for info in list_files_info(f'{source_dataset}', repo_type="dataset")]
|
|
|
63 |
pass
|
64 |
except Exception as e:
|
65 |
print(e)
|
66 |
+
return(out_html,gr.Dropdown(label="Videos",type="index", choices=[s for s in vid_list],interactive=True))
|
67 |
|
68 |
|
69 |
+
def show_vid(vid_file,list_hid):
|
70 |
|
71 |
#vid_slug=vid_file.split("videos/",1)[1].split(".",1)[0]
|
72 |
|
73 |
label_html=f'''{label_html}
|
74 |
+
<video src="https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/{list_hid[int(vid_file)]}" controls>
|
75 |
</video>'''
|
76 |
return label_html
|
77 |
|
|
|
124 |
button = gr.Button()
|
125 |
output = gr.HTML()
|
126 |
label_output = gr.HTML()
|
127 |
+
list_hid=gr.Textbox()
|
128 |
|
129 |
app.load(find_dataset,None,channel)
|
130 |
+
channel.change(load_vid,channel,[output,videos,list_hid])
|
131 |
+
videos.change(show_vid,[videos,list_hid],[label_output])
|
132 |
|
133 |
app.launch(show_api=False,share=False)
|