f64 commited on
Commit
adce439
·
1 Parent(s): 265804e
Files changed (2) hide show
  1. my_static_methods.py +2 -2
  2. pages/6_TECT_7_ID.py +6 -3
my_static_methods.py CHANGED
@@ -90,12 +90,12 @@ def load_dataframes_from_hf(repo: HfRepo, lstCsvFiles: list[str] = []) -> {str,
90
  ### https://huggingface.co/docs/huggingface_hub/en/guides/hf_file_system
91
  def list_files_hf(repo: HfRepo) -> list[str]:
92
  """ List CSV and ZIP files in HF repo """
93
- fs = huggingface_hub.HfFileSystem(token=repo.token)
94
  path_hf = f"{repo.repo_type}s/{repo.repo_id}/"
95
  #lst = fs.ls(path_hf, detail=False)
96
  lstGlob = fs.glob(path_hf + "**") # map(os.path.basename, lstGlob)
97
  lstNames = [fname.replace(path_hf, "") for fname in lstGlob if fname.lower().endswith(".csv") or fname.lower().endswith(".zip")]
98
- print(f"{lstNames=}")
99
  return lstNames
100
 
101
  ###
 
90
  ### https://huggingface.co/docs/huggingface_hub/en/guides/hf_file_system
91
  def list_files_hf(repo: HfRepo) -> list[str]:
92
  """ List CSV and ZIP files in HF repo """
93
+ fs = huggingface_hub.HfFileSystem(token=repo.token) #, use_listings_cache=False) # , skip_instance_cache=True
94
  path_hf = f"{repo.repo_type}s/{repo.repo_id}/"
95
  #lst = fs.ls(path_hf, detail=False)
96
  lstGlob = fs.glob(path_hf + "**") # map(os.path.basename, lstGlob)
97
  lstNames = [fname.replace(path_hf, "") for fname in lstGlob if fname.lower().endswith(".csv") or fname.lower().endswith(".zip")]
98
+ print(f"ПРОЧИТАНО В list_files_hf() : {lstNames=}")
99
  return lstNames
100
 
101
  ###
pages/6_TECT_7_ID.py CHANGED
@@ -84,7 +84,8 @@ with col1.popover("🆕 добавить новый файл", use_container_wid
84
  if st.button(f"такой файл есть! перезаписать файл '{fileXYZ}'?"):
85
  save_dataframe_nodialog_idxyz(fileXYZ, dfToUpload)
86
  else:
87
- save_dataframe_nodialog_idxyz(fileXYZ, dfToUpload)
 
88
  else:
89
  st.error(f"Разные размеры пакетов для разных ID, варианты : {lst_len}")
90
  else:
@@ -118,7 +119,9 @@ if selectedFile is not None:
118
  x_test_vect = df_packs_reshaped.iloc[:,1:]
119
  df_packs_reshaped["Прогноз_V"] = classifier_object.predict(x_test_vect.values)
120
  col2.dataframe(df_packs_reshaped[["ID","Прогноз_V"]], height=620)
121
- col1.write(st.session_state)
122
-
123
 
 
 
 
 
124
 
 
84
  if st.button(f"такой файл есть! перезаписать файл '{fileXYZ}'?"):
85
  save_dataframe_nodialog_idxyz(fileXYZ, dfToUpload)
86
  else:
87
+ if st.button(f"новый файл '{fileXYZ}' - Записать на сервер?"):
88
+ save_dataframe_nodialog_idxyz(fileXYZ, dfToUpload)
89
  else:
90
  st.error(f"Разные размеры пакетов для разных ID, варианты : {lst_len}")
91
  else:
 
119
  x_test_vect = df_packs_reshaped.iloc[:,1:]
120
  df_packs_reshaped["Прогноз_V"] = classifier_object.predict(x_test_vect.values)
121
  col2.dataframe(df_packs_reshaped[["ID","Прогноз_V"]], height=620)
 
 
122
 
123
+ # col2.write(st.session_state) # для отладки
124
+ else:
125
+ col2.write(st.session_state) # для отладки
126
+ col2.warning(f"Не найден на сервере файл '{selectedFile}'")
127