Omnibus commited on
Commit
12a8720
1 Parent(s): eef3a59

Update player.py

Browse files
Files changed (1) hide show
  1. player.py +20 -4
player.py CHANGED
@@ -5,9 +5,25 @@ import json
5
  token = ""
6
  source_dataset = "jbilcke-hf/ai-tube-index"
7
  api = HfApi(token=token)
8
-
9
-
10
  def find_dataset(author=None):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  s_ist = (api.list_datasets(author=author,search="ai-tube"))
12
  #print(api.whoami())
13
  spaces=[]
@@ -58,8 +74,8 @@ def find_dataset(author=None):
58
  print(spaces)
59
  return(out_html)
60
  with gr.Blocks() as app:
61
- author = gr.Textbox(label="Author")
62
  button = gr.Button()
63
  output = gr.HTML()
64
- button.click(find_dataset,author,output)
65
  app.launch(show_api=False,share=False)
 
5
  token = ""
6
  source_dataset = "jbilcke-hf/ai-tube-index"
7
  api = HfApi(token=token)
 
 
8
  def find_dataset(author=None):
9
+ s_ist = (api.list_datasets(author=author,search="ai-tube"))
10
+ #print(api.whoami())
11
+ authors=[]
12
+ videos=[]
13
+ out_html=""
14
+ for space in s_ist:
15
+ #for i,space in enumerate(s_ist):
16
+ try:
17
+ space_loc=space.id
18
+ space_auth=space_loc.split("/",1)[0]
19
+ space_name=space_loc.split("/",1)[0]
20
+ #space_ea = space.id.split("/",1)[1]
21
+ authors.append(space.id)
22
+ except Exception:
23
+ pass
24
+ return (gr.Dropdown.update(label="Spaces", choices=[s for s in spaces])
25
+
26
+ def find_dataset_og(author=None):
27
  s_ist = (api.list_datasets(author=author,search="ai-tube"))
28
  #print(api.whoami())
29
  spaces=[]
 
74
  print(spaces)
75
  return(out_html)
76
  with gr.Blocks() as app:
77
+ author = gr.Dropdown(label="Author")
78
  button = gr.Button()
79
  output = gr.HTML()
80
+ button.click(find_dataset,None,author)
81
  app.launch(show_api=False,share=False)