Omnibus commited on
Commit
0f452c8
1 Parent(s): c5b4d48

Update dl.py

Browse files
Files changed (1) hide show
  1. dl.py +14 -17
dl.py CHANGED
@@ -26,7 +26,8 @@ def show_s(name,token):
26
  space_ea = space.id.split("/",1)[1]
27
  spaces.append(space_ea)
28
  #print (space_ea)
29
- return(gr.Dropdown.update(label="Spaces", choices=[s for s in spaces]))
 
30
 
31
  def show_f(repo,name,token):
32
  api = HfApi(token=token)
@@ -79,7 +80,9 @@ def show_f(repo,name,token):
79
  zipObj.write(f'{name}/{file}')
80
  file_list.append(f'{name}.zip')
81
 
82
- return(gr.Dropdown.update(label="Files", choices=[f for f in f_ist],interactive=True), file_list)
 
 
83
 
84
  def show_f2(repo,name,token):
85
  api = HfApi(token=token)
@@ -252,27 +255,21 @@ with gr.Blocks() as build:
252
  r_t=gr.Textbox(max_lines=100)
253
  m_t=gr.Textbox(max_lines=100)
254
  uu=gr.Textbox(visible=False)
255
- test_btn=gr.Button("test button")
256
- test_col = gr.Group()
257
-
258
- def pop_buttons(repo,name):
259
- api = HfApi(token="")
260
- f_ist = (api.list_repo_files(repo_id=f'{repo}/{name}', repo_type="space"))
261
- print(f_ist)
262
- for ea in f_ist:
263
- outp = gr.Button("ea")
264
- return gr.update(test_col.append(gr.Audio()))
265
 
266
-
267
-
268
- test_btn.click(pop_buttons,[r_name,s_name],test_col)
269
  show_all_btn1.click(show_all,[r_name,token],files)
270
  show_all_btn2.click(show_all_z,[r_name,token],files)
271
 
272
- s_btn.click(show_s,[r_name,token],s_name)
 
273
  f_name.change(show_f_cont,[r_name,s_name,f_name],[r_h,r_t])
274
  #s_name.change(show_f,[r_name,s_name,token],[d_app,files])
275
- l_btn.click(show_f,[r_name,s_name,token], [f_name, files])
276
 
277
  pass_btn.click(checkp,pass_box,[no,yes])
278
  #inbut.click(build_space,[token,t_name,s_type,m_type,r_type,d_app,d_css],output_html)
 
26
  space_ea = space.id.split("/",1)[1]
27
  spaces.append(space_ea)
28
  #print (space_ea)
29
+ return(gr.Dropdown.update(label="Spaces", choices=[s for s in spaces]),
30
+ gr.update(choices=[s for s in spaces]))
31
 
32
  def show_f(repo,name,token):
33
  api = HfApi(token=token)
 
80
  zipObj.write(f'{name}/{file}')
81
  file_list.append(f'{name}.zip')
82
 
83
+ return(gr.Dropdown.update(label="Files", choices=[f for f in f_ist],interactive=True),
84
+ file_list,
85
+ gr.update(choices=[f for f in f_ist]))
86
 
87
  def show_f2(repo,name,token):
88
  api = HfApi(token=token)
 
255
  r_t=gr.Textbox(max_lines=100)
256
  m_t=gr.Textbox(max_lines=100)
257
  uu=gr.Textbox(visible=False)
258
+ with gr.Row():
259
+ with gr.Column():
260
+ space_radio=gr.Radio(label="Spaces",choices=[])
261
+ with gr.Column():
262
+ file_radio=gr.Radio(label="Files",choices=[])
263
+ gr.Column()
264
+ gr.Column()
 
 
 
265
 
 
 
 
266
  show_all_btn1.click(show_all,[r_name,token],files)
267
  show_all_btn2.click(show_all_z,[r_name,token],files)
268
 
269
+ s_btn.click(show_s,[r_name,token],[s_name,space_radio])
270
+ l_btn.click(show_f,[r_name,s_name,token], [f_name, files,file_radio])
271
  f_name.change(show_f_cont,[r_name,s_name,f_name],[r_h,r_t])
272
  #s_name.change(show_f,[r_name,s_name,token],[d_app,files])
 
273
 
274
  pass_btn.click(checkp,pass_box,[no,yes])
275
  #inbut.click(build_space,[token,t_name,s_type,m_type,r_type,d_app,d_css],output_html)