Update app.py
Browse files
app.py
CHANGED
@@ -108,29 +108,25 @@ if 'key0' in st.session_state:
|
|
108 |
# Pie chart
|
109 |
with col1:
|
110 |
|
111 |
-
st.write(type(st.session_state['key0']))
|
112 |
-
st.write(st.session_state['key0'])
|
113 |
# Create a df that stores how often the labels appear
|
114 |
df_count = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
115 |
|
116 |
-
#
|
117 |
-
|
118 |
-
|
119 |
|
120 |
-
#
|
121 |
-
|
122 |
-
|
123 |
-
#bar_data = st.session_state['key0']
|
124 |
-
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
# color='Country',
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
|
135 |
|
136 |
|
|
|
108 |
# Pie chart
|
109 |
with col1:
|
110 |
|
|
|
|
|
111 |
# Create a df that stores how often the labels appear
|
112 |
df_count = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
113 |
|
114 |
+
# Count how often each label appears in the "Vulnerability Labels" column
|
115 |
+
label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
|
116 |
+
label_counts.columns = ['Label', 'Count']
|
117 |
|
118 |
+
# Merge the label counts with the df_label DataFrame
|
119 |
+
df_label = df_label.merge(label_counts, on='Label', how='left')
|
120 |
+
|
|
|
|
|
121 |
|
122 |
+
fig = px.bar(df_label,
|
123 |
+
x="Label",
|
124 |
+
y="Count",
|
125 |
# color='Country',
|
126 |
+
title='Label Count',
|
127 |
+
hover_name="Value",
|
128 |
+
color_discrete_sequence=px.colors.qualitative.Plotly
|
129 |
+
)
|
130 |
|
131 |
|
132 |
|