Update app.py
Browse files
app.py
CHANGED
@@ -1033,6 +1033,7 @@ def handle_list_spaces(hf_api_key_ui, ui_owner_name):
|
|
1033 |
return md
|
1034 |
|
1035 |
def handle_manual_duplicate_space(hf_api_key_ui, source_owner, source_space_name, target_owner, target_space_name, target_private):
|
|
|
1036 |
if not source_owner or not source_space_name:
|
1037 |
return "Duplicate Error: Please load a Space first to duplicate.", gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
|
1038 |
if not target_owner or not target_space_name:
|
@@ -1063,7 +1064,7 @@ def handle_manual_duplicate_space(hf_api_key_ui, source_owner, source_space_name
|
|
1063 |
|
1064 |
if err_list:
|
1065 |
reload_error = f"Error reloading file list after duplication: {err_list}"
|
1066 |
-
|
1067 |
parsed_code_blocks_state_cache = []
|
1068 |
_file_browser_update = gr.update(visible=False, choices=[], value=None)
|
1069 |
_iframe_html_update = gr.update(value=None, visible=False)
|
@@ -1075,7 +1076,6 @@ def handle_manual_duplicate_space(hf_api_key_ui, source_owner, source_space_name
|
|
1075 |
is_binary = lang == "binary" or (err_get is not None)
|
1076 |
code = f"[Error loading content: {err_get}]" if err_get else (content or "")
|
1077 |
loaded_files.append({"filename": file_path, "code": code, "language": lang, "is_binary": is_binary, "is_structure_block": False})
|
1078 |
-
global parsed_code_blocks_state_cache
|
1079 |
parsed_code_blocks_state_cache = loaded_files
|
1080 |
|
1081 |
_file_browser_update = gr.update(visible=True, choices=sorted([f["filename"] for f in parsed_code_blocks_state_cache if not f.get("is_structure_block")] or []), value=None)
|
|
|
1033 |
return md
|
1034 |
|
1035 |
def handle_manual_duplicate_space(hf_api_key_ui, source_owner, source_space_name, target_owner, target_space_name, target_private):
|
1036 |
+
global parsed_code_blocks_state_cache
|
1037 |
if not source_owner or not source_space_name:
|
1038 |
return "Duplicate Error: Please load a Space first to duplicate.", gr.update(), gr.update(), gr.update(), gr.update(), gr.update(), gr.update()
|
1039 |
if not target_owner or not target_space_name:
|
|
|
1064 |
|
1065 |
if err_list:
|
1066 |
reload_error = f"Error reloading file list after duplication: {err_list}"
|
1067 |
+
|
1068 |
parsed_code_blocks_state_cache = []
|
1069 |
_file_browser_update = gr.update(visible=False, choices=[], value=None)
|
1070 |
_iframe_html_update = gr.update(value=None, visible=False)
|
|
|
1076 |
is_binary = lang == "binary" or (err_get is not None)
|
1077 |
code = f"[Error loading content: {err_get}]" if err_get else (content or "")
|
1078 |
loaded_files.append({"filename": file_path, "code": code, "language": lang, "is_binary": is_binary, "is_structure_block": False})
|
|
|
1079 |
parsed_code_blocks_state_cache = loaded_files
|
1080 |
|
1081 |
_file_browser_update = gr.update(visible=True, choices=sorted([f["filename"] for f in parsed_code_blocks_state_cache if not f.get("is_structure_block")] or []), value=None)
|