Update app.py
Browse files
app.py
CHANGED
|
@@ -133,7 +133,7 @@ def get_f(r_name,spaces,token):
|
|
| 133 |
|
| 134 |
return(files_b,spaces_b)
|
| 135 |
|
| 136 |
-
def build_space(token,r_name,s_name,d_app,rd_name,sd_name,dd_app):
|
| 137 |
if token==None or token=="":
|
| 138 |
token = token_self
|
| 139 |
else:
|
|
@@ -156,7 +156,8 @@ def build_space(token,r_name,s_name,d_app,rd_name,sd_name,dd_app):
|
|
| 156 |
token=token,
|
| 157 |
repo_type="space",
|
| 158 |
)
|
| 159 |
-
|
|
|
|
| 160 |
#os.remove(f"{uid}at.py")
|
| 161 |
return gr.HTML.update(f'''<center>Link to space <a href="https://huggingface.co/spaces/{repo_name}" target="_blank">https://huggingface.co/spaces/{repo_name}</a><center><br>''')
|
| 162 |
except Exception as e:
|
|
@@ -199,6 +200,7 @@ with gr.Blocks() as build:
|
|
| 199 |
with gr.Row():
|
| 200 |
token = gr.Textbox(label="auth")
|
| 201 |
inbut = gr.Button("Update Repo")
|
|
|
|
| 202 |
output_html = gr.HTML("""""")
|
| 203 |
gr.Column(scale=1)
|
| 204 |
with gr.Accordion("Files",open=False):
|
|
@@ -248,5 +250,5 @@ with gr.Blocks() as build:
|
|
| 248 |
r_btn.click(repl,[r_s,r_w,d_app], [m_t,files])
|
| 249 |
|
| 250 |
pass_btn.click(checkp,pass_box,[no,yes])
|
| 251 |
-
inbut.click(build_space,[token,r_name,s_name,d_app,dd_app],output_html)
|
| 252 |
build.queue(concurrency_count=10).launch()
|
|
|
|
| 133 |
|
| 134 |
return(files_b,spaces_b)
|
| 135 |
|
| 136 |
+
def build_space(token,r_name,s_name,d_app,rd_name,sd_name,dd_app,priv):
|
| 137 |
if token==None or token=="":
|
| 138 |
token = token_self
|
| 139 |
else:
|
|
|
|
| 156 |
token=token,
|
| 157 |
repo_type="space",
|
| 158 |
)
|
| 159 |
+
if priv==True:
|
| 160 |
+
api.update_repo_visibility(repo_id=repo_name,private=True,repo_type="space")
|
| 161 |
#os.remove(f"{uid}at.py")
|
| 162 |
return gr.HTML.update(f'''<center>Link to space <a href="https://huggingface.co/spaces/{repo_name}" target="_blank">https://huggingface.co/spaces/{repo_name}</a><center><br>''')
|
| 163 |
except Exception as e:
|
|
|
|
| 200 |
with gr.Row():
|
| 201 |
token = gr.Textbox(label="auth")
|
| 202 |
inbut = gr.Button("Update Repo")
|
| 203 |
+
priv = gr.Checkbox(label="Private")
|
| 204 |
output_html = gr.HTML("""""")
|
| 205 |
gr.Column(scale=1)
|
| 206 |
with gr.Accordion("Files",open=False):
|
|
|
|
| 250 |
r_btn.click(repl,[r_s,r_w,d_app], [m_t,files])
|
| 251 |
|
| 252 |
pass_btn.click(checkp,pass_box,[no,yes])
|
| 253 |
+
inbut.click(build_space,[token,r_name,s_name,d_app,dd_app,priv],output_html)
|
| 254 |
build.queue(concurrency_count=10).launch()
|