Spaces:
Runtime error
Runtime error
Mariusz Kossakowski
commited on
Commit
•
39df437
1
Parent(s):
ea7eaa6
Add dataframe with first 10 observations
Browse files
app.py
CHANGED
@@ -82,6 +82,7 @@ DATA_DICT, DATA_DESCRIPTION = load_hf_dataset()
|
|
82 |
|
83 |
header = st.container()
|
84 |
description = st.container()
|
|
|
85 |
dataset_statistics = st.container()
|
86 |
|
87 |
with header:
|
@@ -91,6 +92,22 @@ with description:
|
|
91 |
st.header("Dataset description")
|
92 |
st.write(DATA_DESCRIPTION)
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
with dataset_statistics:
|
95 |
st.header("Dataset statistics")
|
96 |
st.subheader("Number of samples in each data split")
|
@@ -125,8 +142,8 @@ with dataset_statistics:
|
|
125 |
for k, df in DATA_DICT.items()
|
126 |
]
|
127 |
)
|
128 |
-
|
129 |
-
|
130 |
)
|
131 |
plot_data = [
|
132 |
go.Bar(
|
|
|
82 |
|
83 |
header = st.container()
|
84 |
description = st.container()
|
85 |
+
dataframe_head = st.container()
|
86 |
dataset_statistics = st.container()
|
87 |
|
88 |
with header:
|
|
|
92 |
st.header("Dataset description")
|
93 |
st.write(DATA_DESCRIPTION)
|
94 |
|
95 |
+
with dataframe_head:
|
96 |
+
filtering_options = DATA_DICT["train"]["target"].unique().tolist()
|
97 |
+
filtering_options.append("All classes")
|
98 |
+
|
99 |
+
st.header("First 10 observations of train subset")
|
100 |
+
class_to_show = st.selectbox(
|
101 |
+
label="Select class to show", options=filtering_options
|
102 |
+
)
|
103 |
+
df_to_show = DATA_DICT["train"].copy()
|
104 |
+
if class_to_show == "All classes":
|
105 |
+
df_to_show = df_to_show.head(10)
|
106 |
+
else:
|
107 |
+
df_to_show = df_to_show.loc[df_to_show["target"] == class_to_show].head(10)
|
108 |
+
st.dataframe(df_to_show)
|
109 |
+
st.text_area(label="Latex code", value=df_to_show.style.to_latex())
|
110 |
+
|
111 |
with dataset_statistics:
|
112 |
st.header("Dataset statistics")
|
113 |
st.subheader("Number of samples in each data split")
|
|
|
142 |
for k, df in DATA_DICT.items()
|
143 |
]
|
144 |
)
|
145 |
+
.reset_index()
|
146 |
+
.rename({"index": "split_name"}, axis=1)
|
147 |
)
|
148 |
plot_data = [
|
149 |
go.Bar(
|