Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -128,21 +128,22 @@ def move(repo,space,dest,token):
|
|
128 |
move_repo(from_id=from_id,to_id=to_id,repo_type='space',token=token)
|
129 |
print("REPO MOVED")
|
130 |
|
131 |
-
def add_save(space,
|
132 |
-
|
133 |
this = True
|
134 |
for ea in save_list:
|
135 |
if space == ea:
|
136 |
this = False
|
137 |
if this:
|
138 |
-
save_list.append(space)
|
139 |
-
|
|
|
140 |
|
141 |
-
def rem_save(space,
|
142 |
-
for ea in
|
143 |
if not space == ea:
|
144 |
-
|
145 |
-
return gr.update(choices=[f for f in
|
146 |
|
147 |
with gr.Blocks(css=css) as build:
|
148 |
save_state=gr.State()
|
@@ -186,8 +187,8 @@ with gr.Blocks(css=css) as build:
|
|
186 |
save_btn=gr.Button("Protect")
|
187 |
rem_btn=gr.Button("Remove")
|
188 |
|
189 |
-
save_btn.click(add_save,[space_radio,
|
190 |
-
rem_btn.click(rem_save,[space_radio,save_list],save_list).then(show_s,[r_name,token,save_list],[space_radio])
|
191 |
|
192 |
move_btn.click(move,[r_name,space_radio,dest,token]).then(show_s,[r_name,token,save_list],[space_radio])
|
193 |
s_btn.click(show_s,[r_name,token,save_list],[space_radio])
|
|
|
128 |
move_repo(from_id=from_id,to_id=to_id,repo_type='space',token=token)
|
129 |
print("REPO MOVED")
|
130 |
|
131 |
+
def add_save(space,save_state):
|
132 |
+
save_state=[]if not save_state else save_state
|
133 |
this = True
|
134 |
for ea in save_list:
|
135 |
if space == ea:
|
136 |
this = False
|
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)
|
141 |
|
142 |
+
def rem_save(space,save_state):
|
143 |
+
for ea in save_state:
|
144 |
if not space == ea:
|
145 |
+
save_state.append(space)
|
146 |
+
return save_state, gr.update(choices=[f for f in save_state],interactive=True)
|
147 |
|
148 |
with gr.Blocks(css=css) as build:
|
149 |
save_state=gr.State()
|
|
|
187 |
save_btn=gr.Button("Protect")
|
188 |
rem_btn=gr.Button("Remove")
|
189 |
|
190 |
+
save_btn.click(add_save,[space_radio,save_state],[save_state,save_list]).then(show_s,[r_name,token,save_list],[space_radio])
|
191 |
+
rem_btn.click(rem_save,[space_radio,save_list],[save_state,save_list]).then(show_s,[r_name,token,save_list],[space_radio])
|
192 |
|
193 |
move_btn.click(move,[r_name,space_radio,dest,token]).then(show_s,[r_name,token,save_list],[space_radio])
|
194 |
s_btn.click(show_s,[r_name,token,save_list],[space_radio])
|