Update app.py
Browse files
app.py
CHANGED
@@ -103,32 +103,42 @@ if 'key0' in st.session_state:
|
|
103 |
|
104 |
if topic == 'Vulnerability':
|
105 |
|
106 |
-
### Pie chart
|
107 |
-
|
108 |
-
# Create a df that stores all the labels
|
109 |
-
df_labels = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
110 |
|
111 |
-
|
112 |
-
label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
|
113 |
-
label_counts.columns = ['Label', 'Count']
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
fig = px.pie(df_labels,
|
120 |
-
names="Label",
|
121 |
-
values="Count",
|
122 |
-
title='Label Counts',
|
123 |
-
hover_name="Count",
|
124 |
-
color_discrete_sequence=px.colors.qualitative.Plotly
|
125 |
-
)
|
126 |
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
### Table
|
131 |
-
st.table(st.session_state['key0'])
|
132 |
|
133 |
# vulnerability_analysis.vulnerability_display()
|
134 |
# elif topic == 'Action':
|
|
|
103 |
|
104 |
if topic == 'Vulnerability':
|
105 |
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
col1, col2 = st.columns([1,1])
|
|
|
|
|
108 |
|
109 |
+
with col1:
|
110 |
+
|
111 |
+
### Table
|
112 |
+
st.table(st.session_state['key0'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
with col2:
|
115 |
+
|
116 |
+
### Pie chart
|
117 |
+
|
118 |
+
# Create a df that stores all the labels
|
119 |
+
df_labels = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
120 |
+
|
121 |
+
# Count how often each label appears in the "Vulnerability Labels" column
|
122 |
+
label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
|
123 |
+
label_counts.columns = ['Label', 'Count']
|
124 |
+
|
125 |
+
# Merge the label counts with the df_label DataFrame
|
126 |
+
df_labels = df_labels.merge(label_counts, on='Label', how='left')
|
127 |
+
|
128 |
+
# Configure graph
|
129 |
+
fig = px.pie(df_labels,
|
130 |
+
names="Label",
|
131 |
+
values="Count",
|
132 |
+
title='Label Counts',
|
133 |
+
hover_name="Count",
|
134 |
+
color_discrete_sequence=px.colors.qualitative.Plotly
|
135 |
+
)
|
136 |
+
|
137 |
+
#Show plot
|
138 |
+
st.plotly_chart(fig, use_container_width=True)
|
139 |
|
140 |
### Table
|
141 |
+
#st.table(st.session_state['key0'])
|
142 |
|
143 |
# vulnerability_analysis.vulnerability_display()
|
144 |
# elif topic == 'Action':
|