broadfield-dev commited on
Commit
1b52819
·
verified ·
1 Parent(s): 6aa344d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -591,7 +591,7 @@ def handle_build_space_button(hf_api_key_ui, ui_space_name_part, ui_owner_name_p
591
 
592
 
593
  def handle_load_file_for_editing(hf_api_key_ui, ui_space_name_part, ui_owner_name_part, selected_file_path):
594
- _file_content_val, _edit_status_val, _commit_msg_val, _lang_update = "", "Error: No file selected.", gr.update(value=""), gr.update(language="plaintext") # Reset values
595
  if not selected_file_path or selected_file_path in ["No files found", "Error loading files", "Error refreshing files"]:
596
  yield _file_content_val, "Select a file from the dropdown.", _commit_msg_val, _lang_update # Clear editor and status
597
  return
@@ -610,7 +610,7 @@ def handle_load_file_for_editing(hf_api_key_ui, ui_space_name_part, ui_owner_nam
610
  if not owner_to_use or not ui_space_name_part: _edit_status_val = "Error: HF Owner and/or Space Name is missing."; yield (_file_content_val, _edit_status_val, _commit_msg_val, _lang_update); return
611
 
612
  _edit_status_val = f"Loading {selected_file_path}..."
613
- yield gr.update(value=""), _edit_status_val, gr.update(value=""), gr.update(language="plaintext") # Yield loading state
614
 
615
  content, err = get_space_file_content(hf_api_key_ui, ui_space_name_part, owner_to_use, selected_file_path)
616
 
@@ -618,7 +618,7 @@ def handle_load_file_for_editing(hf_api_key_ui, ui_space_name_part, ui_owner_nam
618
  _edit_status_val = f"Error loading '{selected_file_path}': {err}"
619
  _commit_msg_val = f"Error loading {selected_file_path}"
620
  _file_content_val = f"Error loading {selected_file_path}:\n{err}"
621
- _lang_update = gr.update(language="plaintext")
622
  yield _file_content_val, _edit_status_val, _commit_msg_val, _lang_update
623
  return
624
 
 
591
 
592
 
593
  def handle_load_file_for_editing(hf_api_key_ui, ui_space_name_part, ui_owner_name_part, selected_file_path):
594
+ _file_content_val, _edit_status_val, _commit_msg_val, _lang_update = "", "Error: No file selected.", gr.update(value=""), gr.update(language="python") # Reset values
595
  if not selected_file_path or selected_file_path in ["No files found", "Error loading files", "Error refreshing files"]:
596
  yield _file_content_val, "Select a file from the dropdown.", _commit_msg_val, _lang_update # Clear editor and status
597
  return
 
610
  if not owner_to_use or not ui_space_name_part: _edit_status_val = "Error: HF Owner and/or Space Name is missing."; yield (_file_content_val, _edit_status_val, _commit_msg_val, _lang_update); return
611
 
612
  _edit_status_val = f"Loading {selected_file_path}..."
613
+ yield gr.update(value=""), _edit_status_val, gr.update(value=""), gr.update(language="python") # Yield loading state
614
 
615
  content, err = get_space_file_content(hf_api_key_ui, ui_space_name_part, owner_to_use, selected_file_path)
616
 
 
618
  _edit_status_val = f"Error loading '{selected_file_path}': {err}"
619
  _commit_msg_val = f"Error loading {selected_file_path}"
620
  _file_content_val = f"Error loading {selected_file_path}:\n{err}"
621
+ _lang_update = gr.update(language="python")
622
  yield _file_content_val, _edit_status_val, _commit_msg_val, _lang_update
623
  return
624