zhaorui-nb
commited on
Commit
•
74625f5
1
Parent(s):
2008979
mv filter to sidebar
Browse files
README.md
CHANGED
@@ -16,7 +16,13 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
16 |
|
17 |
|
18 |
# de-identification-leaderboard
|
19 |
-
## run web
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
```
|
21 |
streamlit run app.py
|
22 |
```
|
|
|
16 |
|
17 |
|
18 |
# de-identification-leaderboard
|
19 |
+
## run web local
|
20 |
+
### key
|
21 |
+
creat file `.streamlit\secrets.toml`
|
22 |
+
```
|
23 |
+
hf = "your token"
|
24 |
+
```
|
25 |
+
|
26 |
```
|
27 |
streamlit run app.py
|
28 |
```
|
app.py
CHANGED
@@ -70,28 +70,28 @@ def get_leaderboard_df():
|
|
70 |
st.title('De-identification Model Leaderboard')
|
71 |
|
72 |
try:
|
73 |
-
with st.container():
|
74 |
-
# columns
|
75 |
-
# ['model name', 'dataset', 'method', 'file name', 'submitter',
|
76 |
-
# 'MICRO precision', 'MICRO recall', 'MICRO f1', 'MACRO precision',
|
77 |
-
# 'MACRO recall', 'MACRO f1', 'detail result']
|
78 |
|
|
|
|
|
|
|
|
|
79 |
df = get_leaderboard_df()
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
84 |
|
85 |
-
#
|
86 |
-
|
87 |
-
|
88 |
-
leaderboard_df = st.dataframe(filtered_df[selected_columns], selection_mode='multi-row', on_select='rerun', key='leaderboard')
|
89 |
|
|
|
90 |
|
91 |
st.subheader("Detail Result")
|
92 |
det_ind = st.session_state.leaderboard['selection']['rows']
|
93 |
if len(det_ind) == 0:
|
94 |
-
st.write(f'Please check the boxes to view the detailed results.')
|
95 |
else:
|
96 |
col_detial = st.columns(len(det_ind))
|
97 |
for i, dind in enumerate(det_ind):
|
|
|
70 |
st.title('De-identification Model Leaderboard')
|
71 |
|
72 |
try:
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
+
|
75 |
+
|
76 |
+
with st.container():
|
77 |
+
# columns ['model name', 'dataset', 'method', 'file name', 'submitter', 'MICRO precision', 'MICRO recall', 'MICRO f1', 'MACRO precision', 'MACRO recall', 'MACRO f1', 'detail result']
|
78 |
df = get_leaderboard_df()
|
79 |
|
80 |
+
with st.sidebar: # st.expander("Leaderboard", expanded=True):
|
81 |
+
default_columns = [c for c in df.columns if c not in ['file name', 'submitter', 'MICRO precision', 'MICRO recall', 'MACRO precision', 'MACRO recall', 'detail result']]
|
82 |
+
selected_columns = st.multiselect('Select columns to display', df.columns, default=default_columns)
|
83 |
+
# add filterable dataframe
|
84 |
+
filtered_df = filterable_dataframe(df)
|
85 |
|
86 |
+
# hit the user can filter the leaderboard at the sidebar
|
87 |
+
st.write("setting the filter at the sidebar")
|
|
|
|
|
88 |
|
89 |
+
leaderboard_df = st.dataframe(filtered_df[selected_columns], selection_mode='multi-row', on_select='rerun', key='leaderboard')
|
90 |
|
91 |
st.subheader("Detail Result")
|
92 |
det_ind = st.session_state.leaderboard['selection']['rows']
|
93 |
if len(det_ind) == 0:
|
94 |
+
st.write(f'Please check the boxes in the Model Leaderboard to view the detailed results.')
|
95 |
else:
|
96 |
col_detial = st.columns(len(det_ind))
|
97 |
for i, dind in enumerate(det_ind):
|