Omnibus commited on
Commit
d746966
1 Parent(s): c7ab6ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -37,8 +37,8 @@ def show_s(name,token,save_list):
37
  else:
38
  spaces.append(space_ea)
39
  #print (space_ea)
40
- return(gr.update(label="Spaces", choices=[s for s in spaces]),spaces)
41
- #gr.update(choices=[s for s in spaces],interactive=True))
42
 
43
  def show_f(repo,name,token,tog):
44
  api = HfApi(token=token)
@@ -137,7 +137,9 @@ def add_save(space,save_state):
137
  if this:
138
  #save_list.append(space)
139
  save_state.append(space)
140
- return save_state,gr.update(choices=[f for f in save_state],interactive=True),save_state
 
 
141
 
142
  def rem_save(space,save_state):
143
  save_out=[]
@@ -146,8 +148,9 @@ def rem_save(space,save_state):
146
  print(ea)
147
  if not space == ea:
148
  save_out.append(space)
149
- return save_out, gr.update(choices=[f for f in save_out],interactive=True),save_out
150
-
 
151
 
152
  def toggle_comments_off(r_name,check_list,token):
153
  api = HfApi(token=token)
@@ -208,7 +211,7 @@ with gr.Blocks(css=css) as build:
208
  with gr.Tab("Controls"):
209
  with gr.Row():
210
  with gr.Column():
211
- check_list=gr.CheckboxGroup(choices=[s for s in space_list])
212
  com_off = gr.Button("Turn OFF Commenting")
213
  com_on = gr.Button("Turn ON Commenting")
214
 
@@ -218,11 +221,11 @@ with gr.Blocks(css=css) as build:
218
 
219
  com_off.click(toggle_comments_off, [r_name,check_list,token])
220
 
221
- save_btn.click(add_save,[space_radio,save_state],[save_state,save_list]).then(show_s,[r_name,token,save_state],[space_radio,space_list])
222
- rem_btn.click(rem_save,[space_radio,save_state],[save_state,save_list]).then(show_s,[r_name,token,save_state],[space_radio,space_list])
223
 
224
- move_btn.click(move,[r_name,space_radio,dest,token]).then(show_s,[r_name,token,save_state],[space_radio,space_list])
225
- s_btn.click(show_s,[r_name,token,save_list],[space_radio,space_list])
226
 
227
  space_radio.change(show_f,[r_name,space_radio,token,tog],[files,file_radio,space_info_json])
228
  file_radio.change(show_f_cont,[r_name,space_radio,file_radio,token],[file_contents])
 
37
  else:
38
  spaces.append(space_ea)
39
  #print (space_ea)
40
+ return(gr.update(label="Spaces", choices=[s for s in spaces]),
41
+ gr.update(choices=[s for s in spaces],interactive=True))
42
 
43
  def show_f(repo,name,token,tog):
44
  api = HfApi(token=token)
 
137
  if this:
138
  #save_list.append(space)
139
  save_state.append(space)
140
+ return (save_state,
141
+ gr.update(choices=[f for f in save_state],interactive=True),
142
+ gr.update(choices=[f for f in save_state],interactive=True))
143
 
144
  def rem_save(space,save_state):
145
  save_out=[]
 
148
  print(ea)
149
  if not space == ea:
150
  save_out.append(space)
151
+ return (save_out,
152
+ gr.update(choices=[f for f in save_out],interactive=True),
153
+ gr.update(choices=[f for f in save_out],interactive=True))
154
 
155
  def toggle_comments_off(r_name,check_list,token):
156
  api = HfApi(token=token)
 
211
  with gr.Tab("Controls"):
212
  with gr.Row():
213
  with gr.Column():
214
+ check_list=gr.CheckboxGroup(choices=[])
215
  com_off = gr.Button("Turn OFF Commenting")
216
  com_on = gr.Button("Turn ON Commenting")
217
 
 
221
 
222
  com_off.click(toggle_comments_off, [r_name,check_list,token])
223
 
224
+ save_btn.click(add_save,[space_radio,save_state],[save_state,save_list]).then(show_s,[r_name,token,save_state],[space_radio,check_list])
225
+ rem_btn.click(rem_save,[space_radio,save_state],[save_state,save_list]).then(show_s,[r_name,token,save_state],[space_radio,check_list])
226
 
227
+ move_btn.click(move,[r_name,space_radio,dest,token]).then(show_s,[r_name,token,save_state],[space_radio,check_list])
228
+ s_btn.click(show_s,[r_name,token,save_list],[space_radio,check_list])
229
 
230
  space_radio.change(show_f,[r_name,space_radio,token,tog],[files,file_radio,space_info_json])
231
  file_radio.change(show_f_cont,[r_name,space_radio,file_radio,token],[file_contents])