Update app.py
Browse files
app.py
CHANGED
|
@@ -45,7 +45,7 @@ def show_s(name,d_app,token):
|
|
| 45 |
#spaces2.append(line3)
|
| 46 |
spaces.append(line2)
|
| 47 |
print(f"{line2}")
|
| 48 |
-
return(gr.update(label="Spaces", choices=[s for s in spaces])
|
| 49 |
|
| 50 |
def show_f(repo,name,token):
|
| 51 |
api = HfApi(token=token)
|
|
@@ -81,8 +81,8 @@ def get_f(r_name,spaces,token):
|
|
| 81 |
api = HfApi(token=token)
|
| 82 |
spaces_b=[]
|
| 83 |
files_b=[]
|
| 84 |
-
spaces=spaces.replace("[","").replace("]","").replace("'","").replace(" ","")
|
| 85 |
-
spaces=spaces.split(",")
|
| 86 |
print (spaces)
|
| 87 |
|
| 88 |
for space in spaces:
|
|
@@ -147,7 +147,7 @@ with gr.Blocks() as build:
|
|
| 147 |
token = gr.Textbox(label="auth")
|
| 148 |
|
| 149 |
with gr.Row():
|
| 150 |
-
s_name = gr.Dropdown(label="Spaces", choices=[]
|
| 151 |
d_app = gr.Dropdown(label="Files", choices=[])
|
| 152 |
with gr.Row():
|
| 153 |
s_btn = gr.Button("Show")
|
|
@@ -164,7 +164,9 @@ with gr.Blocks() as build:
|
|
| 164 |
with gr.Tab("Modify"):
|
| 165 |
files=gr.File()
|
| 166 |
with gr.Tab("Download"):
|
| 167 |
-
|
|
|
|
|
|
|
| 168 |
a_files=gr.File()
|
| 169 |
|
| 170 |
with gr.Row():
|
|
@@ -176,10 +178,10 @@ with gr.Blocks() as build:
|
|
| 176 |
def cyc(x):
|
| 177 |
return x,None
|
| 178 |
|
| 179 |
-
f_btn.click(get_f,[r_name,
|
| 180 |
r_t.change(cyc,r_t,[m_t,files])
|
| 181 |
|
| 182 |
-
s_btn.click(show_s,r_name,[s_name,
|
| 183 |
s_name.change(show_f,[r_name,s_name],d_app)
|
| 184 |
|
| 185 |
l_btn.click(load_space,[r_name,s_name,d_app],[r_t,uu])
|
|
|
|
| 45 |
#spaces2.append(line3)
|
| 46 |
spaces.append(line2)
|
| 47 |
print(f"{line2}")
|
| 48 |
+
return(gr.update(label="Spaces", choices=[s for s in spaces]),gr.update(label="Spaces", choices=[s for s in spaces]))
|
| 49 |
|
| 50 |
def show_f(repo,name,token):
|
| 51 |
api = HfApi(token=token)
|
|
|
|
| 81 |
api = HfApi(token=token)
|
| 82 |
spaces_b=[]
|
| 83 |
files_b=[]
|
| 84 |
+
#spaces=spaces.replace("[","").replace("]","").replace("'","").replace(" ","")
|
| 85 |
+
#spaces=spaces.split(",")
|
| 86 |
print (spaces)
|
| 87 |
|
| 88 |
for space in spaces:
|
|
|
|
| 147 |
token = gr.Textbox(label="auth")
|
| 148 |
|
| 149 |
with gr.Row():
|
| 150 |
+
s_name = gr.Dropdown(label="Spaces", choices=[])
|
| 151 |
d_app = gr.Dropdown(label="Files", choices=[])
|
| 152 |
with gr.Row():
|
| 153 |
s_btn = gr.Button("Show")
|
|
|
|
| 164 |
with gr.Tab("Modify"):
|
| 165 |
files=gr.File()
|
| 166 |
with gr.Tab("Download"):
|
| 167 |
+
with gr.Row():
|
| 168 |
+
ss_name = gr.Dropdown(label="Spaces", choices=[],multiselect=True)
|
| 169 |
+
f_btn=gr.Button()
|
| 170 |
a_files=gr.File()
|
| 171 |
|
| 172 |
with gr.Row():
|
|
|
|
| 178 |
def cyc(x):
|
| 179 |
return x,None
|
| 180 |
|
| 181 |
+
f_btn.click(get_f,[r_name,ss_name,token],None)
|
| 182 |
r_t.change(cyc,r_t,[m_t,files])
|
| 183 |
|
| 184 |
+
s_btn.click(show_s,r_name,[s_name,ss_name])
|
| 185 |
s_name.change(show_f,[r_name,s_name],d_app)
|
| 186 |
|
| 187 |
l_btn.click(load_space,[r_name,s_name,d_app],[r_t,uu])
|