Omnibus commited on
Commit
c11f347
1 Parent(s): 5f9249e

Update player.py

Browse files
Files changed (1) hide show
  1. player.py +7 -3
player.py CHANGED
@@ -20,6 +20,7 @@ def find_dataset(author=""):
20
 
21
  def load_vid(channel):
22
  out_html=""
 
23
  try:
24
  file_box = [info.path for info in list_files_info(f'{channel}', repo_type="dataset")]
25
  ai_tube_box = [info.path for info in list_files_info(f'{source_dataset}', repo_type="dataset")]
@@ -39,7 +40,8 @@ def load_vid(channel):
39
  if vid_file.endswith(".json"):
40
  r = requests.get(f'https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/raw/main/videos/{vid_slug}.json')
41
  #r = requests.get(f'https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/blob/main/videos/00b4bcda-7b4a-40f8-9833-e490425a7b91.mp4')
42
-
 
43
  print (r.json())
44
  if vid_file.endswith(".mp4"):
45
  #<source src="https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/videos/{vid_file}" type="video/mp4">
@@ -58,13 +60,15 @@ def load_vid(channel):
58
  pass
59
  except Exception as e:
60
  print(e)
61
- return(out_html)
62
  with gr.Blocks() as app:
63
  with gr.Row():
64
  channel = gr.Dropdown()
65
  videos = gr.Dropdown()
66
  button = gr.Button()
67
  output = gr.HTML()
 
 
68
  app.load(find_dataset,None,channel)
69
- channel.change(load_vid,channel,output)
70
  app.launch(show_api=False,share=False)
 
20
 
21
  def load_vid(channel):
22
  out_html=""
23
+ label_html=""
24
  try:
25
  file_box = [info.path for info in list_files_info(f'{channel}', repo_type="dataset")]
26
  ai_tube_box = [info.path for info in list_files_info(f'{source_dataset}', repo_type="dataset")]
 
40
  if vid_file.endswith(".json"):
41
  r = requests.get(f'https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/raw/main/videos/{vid_slug}.json')
42
  #r = requests.get(f'https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/blob/main/videos/00b4bcda-7b4a-40f8-9833-e490425a7b91.mp4')
43
+ json_out=r.json()
44
+ label_html=f'{label_html}{json_out["label"]}<br>{json_out["description"]}<br>'
45
  print (r.json())
46
  if vid_file.endswith(".mp4"):
47
  #<source src="https://huggingface.co/datasets/jbilcke-hf/ai-tube-index/resolve/main/videos/{vid_file}" type="video/mp4">
 
60
  pass
61
  except Exception as e:
62
  print(e)
63
+ return(out_html,label_html)
64
  with gr.Blocks() as app:
65
  with gr.Row():
66
  channel = gr.Dropdown()
67
  videos = gr.Dropdown()
68
  button = gr.Button()
69
  output = gr.HTML()
70
+ label_output = gr.HTML()
71
+
72
  app.load(find_dataset,None,channel)
73
+ channel.change(load_vid,channel,[output,label_output])
74
  app.launch(show_api=False,share=False)