Upload folder using huggingface_hub
Browse files- app/draw_diagram.py +4 -21
- app/summarization.py +6 -2
app/draw_diagram.py
CHANGED
|
@@ -72,18 +72,14 @@ def draw(folder_name, category_name, dataset_name, metrics, cus_sort=True):
|
|
| 72 |
|
| 73 |
chart_data_table = chart_data[['model_show', chart_data.columns[1], chart_data.columns[3]]]
|
| 74 |
|
| 75 |
-
|
| 76 |
# Format numeric columns to 2 decimal places
|
| 77 |
-
chart_data_table[chart_data_table.columns[1]] = chart_data_table[chart_data_table.columns[1]].apply(lambda x: round(float(x), 3) if isinstance(float(x), (int, float)) else float(x))
|
| 78 |
-
|
| 79 |
-
|
| 80 |
cur_dataset_name = chart_data_table.columns[1]
|
| 81 |
|
| 82 |
|
| 83 |
def highlight_first_element(x):
|
| 84 |
# Create a DataFrame with the same shape as the input
|
| 85 |
df_style = pd.DataFrame('', index=x.index, columns=x.columns)
|
| 86 |
-
|
| 87 |
# Apply background color to the first element in row 0 (df[0][0])
|
| 88 |
df_style.iloc[0, 1] = 'background-color: #b0c1d7; color: white'
|
| 89 |
|
|
@@ -118,26 +114,13 @@ def draw(folder_name, category_name, dataset_name, metrics, cus_sort=True):
|
|
| 118 |
ascending=False
|
| 119 |
).reset_index(drop=True)
|
| 120 |
|
| 121 |
-
# styled_df = chart_data_table.style.highlight_min(
|
| 122 |
-
# subset=[chart_data_table.columns[1]], color='yellow'
|
| 123 |
-
# )
|
| 124 |
|
| 125 |
-
styled_df = chart_data_table.style.
|
|
|
|
|
|
|
| 126 |
highlight_first_element, axis=None
|
| 127 |
)
|
| 128 |
|
| 129 |
-
# else:
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
# # styled_df = chart_data_table.style.highlight_max(
|
| 134 |
-
# # subset=[chart_data_table.columns[1]], color='yellow'
|
| 135 |
-
# # )
|
| 136 |
-
|
| 137 |
-
# styled_df = chart_data_table.style.apply(
|
| 138 |
-
# highlight_first_element, axis=None
|
| 139 |
-
# )
|
| 140 |
-
|
| 141 |
|
| 142 |
st.dataframe(
|
| 143 |
styled_df,
|
|
|
|
| 72 |
|
| 73 |
chart_data_table = chart_data[['model_show', chart_data.columns[1], chart_data.columns[3]]]
|
| 74 |
|
|
|
|
| 75 |
# Format numeric columns to 2 decimal places
|
| 76 |
+
#chart_data_table[chart_data_table.columns[1]] = chart_data_table[chart_data_table.columns[1]].apply(lambda x: round(float(x), 3) if isinstance(float(x), (int, float)) else float(x))
|
|
|
|
|
|
|
| 77 |
cur_dataset_name = chart_data_table.columns[1]
|
| 78 |
|
| 79 |
|
| 80 |
def highlight_first_element(x):
|
| 81 |
# Create a DataFrame with the same shape as the input
|
| 82 |
df_style = pd.DataFrame('', index=x.index, columns=x.columns)
|
|
|
|
| 83 |
# Apply background color to the first element in row 0 (df[0][0])
|
| 84 |
df_style.iloc[0, 1] = 'background-color: #b0c1d7; color: white'
|
| 85 |
|
|
|
|
| 114 |
ascending=False
|
| 115 |
).reset_index(drop=True)
|
| 116 |
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
styled_df = chart_data_table.style.format(
|
| 119 |
+
{chart_data_table.columns[1]: "{:.3f}"}
|
| 120 |
+
).apply(
|
| 121 |
highlight_first_element, axis=None
|
| 122 |
)
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
st.dataframe(
|
| 126 |
styled_df,
|
app/summarization.py
CHANGED
|
@@ -102,7 +102,12 @@ def sum_table_mulit_metrix(task_name, metrics_lists: List[str]):
|
|
| 102 |
df_style.iloc[0, 1] = 'background-color: #b0c1d7; color: white'
|
| 103 |
return df_style
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
highlight_first_element, axis=None
|
| 107 |
)
|
| 108 |
|
|
@@ -119,6 +124,5 @@ def sum_table_mulit_metrix(task_name, metrics_lists: List[str]):
|
|
| 119 |
use_container_width=True
|
| 120 |
)
|
| 121 |
|
| 122 |
-
#for metrics in metrics_lists:
|
| 123 |
# Only report the last metrics
|
| 124 |
st.markdown(f'###### Metric: {metrics_info[metrics]}')
|
|
|
|
| 102 |
df_style.iloc[0, 1] = 'background-color: #b0c1d7; color: white'
|
| 103 |
return df_style
|
| 104 |
|
| 105 |
+
|
| 106 |
+
styled_df = chart_data_table.style.format(
|
| 107 |
+
{
|
| 108 |
+
chart_data_table.columns[i]: "{:.3f}" for i in range(1, len(chart_data_table.columns) - 1)
|
| 109 |
+
}
|
| 110 |
+
).apply(
|
| 111 |
highlight_first_element, axis=None
|
| 112 |
)
|
| 113 |
|
|
|
|
| 124 |
use_container_width=True
|
| 125 |
)
|
| 126 |
|
|
|
|
| 127 |
# Only report the last metrics
|
| 128 |
st.markdown(f'###### Metric: {metrics_info[metrics]}')
|