Update app.py
Browse files
app.py
CHANGED
|
@@ -145,7 +145,7 @@ def commit_file(token, repo_id, repo_type, filepath, content, commit_message):
|
|
| 145 |
# --- Download Tab Functions ---
|
| 146 |
|
| 147 |
def list_spaces_for_download(token, author):
|
| 148 |
-
"""Lists spaces for a given author to populate the
|
| 149 |
if not author:
|
| 150 |
gr.Info("Please enter an author (username or organization) to list spaces.")
|
| 151 |
return gr.update(choices=[], value=None)
|
|
@@ -263,7 +263,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), title="Hugging Face Hub
|
|
| 263 |
|
| 264 |
with gr.Column(visible=False) as editor_panel:
|
| 265 |
gr.Markdown("### 3. Edit Files")
|
| 266 |
-
file_selector = gr.Dropdown(label="Select File", interactive=
|
| 267 |
code_editor = gr.Code(label="File Content", language="markdown", interactive=True)
|
| 268 |
commit_message_input = gr.Textbox(label="Commit Message", placeholder="e.g., Update README.md", interactive=True)
|
| 269 |
commit_btn = gr.Button("Commit Changes", variant="primary", interactive=False)
|
|
@@ -280,7 +280,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), title="Hugging Face Hub
|
|
| 280 |
)
|
| 281 |
list_spaces_btn = gr.Button("List Spaces", variant="secondary")
|
| 282 |
|
| 283 |
-
|
| 284 |
download_btn = gr.Button("Download Selected Spaces as ZIP", variant="primary")
|
| 285 |
download_output_file = gr.File(label="Your Downloaded ZIP File", visible=False)
|
| 286 |
|
|
@@ -288,12 +288,12 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), title="Hugging Face Hub
|
|
| 288 |
list_spaces_btn.click(
|
| 289 |
fn=list_spaces_for_download,
|
| 290 |
inputs=[hf_token_state, download_author_input],
|
| 291 |
-
outputs=[
|
| 292 |
)
|
| 293 |
|
| 294 |
download_btn.click(
|
| 295 |
fn=download_spaces_as_zip,
|
| 296 |
-
inputs=[hf_token_state,
|
| 297 |
outputs=[download_output_file]
|
| 298 |
)
|
| 299 |
|
|
|
|
| 145 |
# --- Download Tab Functions ---
|
| 146 |
|
| 147 |
def list_spaces_for_download(token, author):
|
| 148 |
+
"""Lists spaces for a given author to populate the dropdown."""
|
| 149 |
if not author:
|
| 150 |
gr.Info("Please enter an author (username or organization) to list spaces.")
|
| 151 |
return gr.update(choices=[], value=None)
|
|
|
|
| 263 |
|
| 264 |
with gr.Column(visible=False) as editor_panel:
|
| 265 |
gr.Markdown("### 3. Edit Files")
|
| 266 |
+
file_selector = gr.Dropdown(label="Select File", interactive=_True)
|
| 267 |
code_editor = gr.Code(label="File Content", language="markdown", interactive=True)
|
| 268 |
commit_message_input = gr.Textbox(label="Commit Message", placeholder="e.g., Update README.md", interactive=True)
|
| 269 |
commit_btn = gr.Button("Commit Changes", variant="primary", interactive=False)
|
|
|
|
| 280 |
)
|
| 281 |
list_spaces_btn = gr.Button("List Spaces", variant="secondary")
|
| 282 |
|
| 283 |
+
spaces_dropdown = gr.Dropdown(label="Available Spaces", info="Select the spaces you want to download.", multiselect=True, interactive=True)
|
| 284 |
download_btn = gr.Button("Download Selected Spaces as ZIP", variant="primary")
|
| 285 |
download_output_file = gr.File(label="Your Downloaded ZIP File", visible=False)
|
| 286 |
|
|
|
|
| 288 |
list_spaces_btn.click(
|
| 289 |
fn=list_spaces_for_download,
|
| 290 |
inputs=[hf_token_state, download_author_input],
|
| 291 |
+
outputs=[spaces_dropdown]
|
| 292 |
)
|
| 293 |
|
| 294 |
download_btn.click(
|
| 295 |
fn=download_spaces_as_zip,
|
| 296 |
+
inputs=[hf_token_state, spaces_dropdown],
|
| 297 |
outputs=[download_output_file]
|
| 298 |
)
|
| 299 |
|