Vũ Thanh Hà commited on
Commit
171412a
1 Parent(s): 267ef18

Update 2_hf_repo_info.py

Browse files
Files changed (1) hide show
  1. 2_hf_repo_info.py +12 -6
2_hf_repo_info.py CHANGED
@@ -10,6 +10,7 @@ from kaggle.api.kaggle_api_extended import KaggleApi
10
 
11
  st.set_page_config(layout="wide")
12
 
 
13
 
14
  @st.cache_resource
15
  def init_kaggle():
@@ -28,11 +29,11 @@ def get_ckpt_list(model):
28
  file_names = [file.rfilename for file in files if "pytorch_model" in file.rfilename]
29
  return file_names
30
 
31
-
32
- with st.form("my_form"):
33
- _author = st.text_input("Author", "hahunavth")
34
- _filter = st.text_input("Slug", "emofs2")
35
- submit = st.form_submit_button("Submit")
36
 
37
  models = list(
38
  list_models(author=_author, filter=_filter, sort="last_modified", direction=-1)
@@ -87,7 +88,12 @@ async def set_df_kernel_status(df, n=12):
87
  df.at[i, "status"] = status
88
  print(i, status)
89
 
90
- st.button("Update kernel status", on_click=lambda: get_kernel_status.clear())
 
 
 
 
 
91
 
92
  asyncio.run(set_df_kernel_status(df))
93
 
 
10
 
11
  st.set_page_config(layout="wide")
12
 
13
+ st.header("Experiments")
14
 
15
  @st.cache_resource
16
  def init_kaggle():
 
29
  file_names = [file.rfilename for file in files if "pytorch_model" in file.rfilename]
30
  return file_names
31
 
32
+ with st.expander("Filter:"):
33
+ with st.form("my_form"):
34
+ _author = st.text_input("Author", "hahunavth")
35
+ _filter = st.text_input("Slug", "emofs2")
36
+ submit = st.form_submit_button("Submit")
37
 
38
  models = list(
39
  list_models(author=_author, filter=_filter, sort="last_modified", direction=-1)
 
88
  df.at[i, "status"] = status
89
  print(i, status)
90
 
91
+ def on_update_kernel_status_click():
92
+ st.session_state["last_update"] = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
93
+ get_kernel_status.clear()
94
+
95
+ st.button("Update kernel status", on_click=on_update_kernel_status_click)
96
+ st.text(f"Last updated: {st.session_state.get('last_update', 'not yet')}")
97
 
98
  asyncio.run(set_df_kernel_status(df))
99