Mariusz Kossakowski commited on
Commit
7a69b9c
·
1 Parent(s): d86d2fc

Fix typing

Browse files
Files changed (1) hide show
  1. app.py +19 -9
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import re
 
2
 
3
  import pandas as pd
4
  import plotly.figure_factory as ff
@@ -12,11 +13,11 @@ st.set_page_config(layout="wide")
12
  DATA_SPLITS = ["train", "dev", "test"]
13
 
14
 
15
- def load_data() -> dict[str, pd.DataFrame]:
16
  return {data: pd.read_csv(f"data/{data}.csv") for data in DATA_SPLITS}
17
 
18
 
19
- def flatten_list(main_list: list[list]) -> list:
20
  return [item for sublist in main_list for item in sublist]
21
 
22
 
@@ -62,8 +63,10 @@ with description:
62
  analyze contracts and understand what they agree upon.
63
  """
64
  st.write(desc)
65
- st.markdown("<h1 style='text-align: center; color: white;'>Dataset statistics</h1>",
66
- unsafe_allow_html=True)
 
 
67
 
68
  with dataset_statistics:
69
  st.header("Number of samples in each data split")
@@ -85,7 +88,11 @@ with dataset_statistics:
85
  metrics_df.columns = ["Subset", "Number of samples"]
86
  st.dataframe(metrics_df)
87
  latex_df = metrics_df.style.to_latex()
88
- st.button(label="Copy table to LaTeX", on_click=lambda: pyperclip.copy(latex_df), key="copy_metrics_df")
 
 
 
 
89
 
90
  # Class distribution in each subset
91
  with class_distribution:
@@ -99,8 +106,8 @@ with class_distribution:
99
  for k, df in DATA_DICT.items()
100
  ]
101
  )
102
- .reset_index()
103
- .rename({"index": "split_name"}, axis=1)
104
  )
105
  barchart_class_dist = go.Figure(
106
  data=[
@@ -128,8 +135,11 @@ with class_distribution:
128
  st.text("")
129
  st.dataframe(hist)
130
  latex_df_class_dist = hist.style.to_latex()
131
- st.button(label="Copy table to LaTeX", on_click=lambda: pyperclip.copy(latex_df_class_dist),
132
- key="copy_class_dist_df")
 
 
 
133
 
134
  # Number of words per observation
135
  hist_data_num_words = [
 
1
  import re
2
+ from typing import Dict, List
3
 
4
  import pandas as pd
5
  import plotly.figure_factory as ff
 
13
  DATA_SPLITS = ["train", "dev", "test"]
14
 
15
 
16
+ def load_data() -> Dict[str, pd.DataFrame]:
17
  return {data: pd.read_csv(f"data/{data}.csv") for data in DATA_SPLITS}
18
 
19
 
20
+ def flatten_list(main_list: List[list]) -> list:
21
  return [item for sublist in main_list for item in sublist]
22
 
23
 
 
63
  analyze contracts and understand what they agree upon.
64
  """
65
  st.write(desc)
66
+ st.markdown(
67
+ "<h1 style='text-align: center; color: white;'>Dataset statistics</h1>",
68
+ unsafe_allow_html=True,
69
+ )
70
 
71
  with dataset_statistics:
72
  st.header("Number of samples in each data split")
 
88
  metrics_df.columns = ["Subset", "Number of samples"]
89
  st.dataframe(metrics_df)
90
  latex_df = metrics_df.style.to_latex()
91
+ st.button(
92
+ label="Copy table to LaTeX",
93
+ on_click=lambda: pyperclip.copy(latex_df),
94
+ key="copy_metrics_df",
95
+ )
96
 
97
  # Class distribution in each subset
98
  with class_distribution:
 
106
  for k, df in DATA_DICT.items()
107
  ]
108
  )
109
+ .reset_index()
110
+ .rename({"index": "split_name"}, axis=1)
111
  )
112
  barchart_class_dist = go.Figure(
113
  data=[
 
135
  st.text("")
136
  st.dataframe(hist)
137
  latex_df_class_dist = hist.style.to_latex()
138
+ st.button(
139
+ label="Copy table to LaTeX",
140
+ on_click=lambda: pyperclip.copy(latex_df_class_dist),
141
+ key="copy_class_dist_df",
142
+ )
143
 
144
  # Number of words per observation
145
  hist_data_num_words = [