leavoigt commited on
Commit
19a3b41
1 Parent(s): de35c97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -47
app.py CHANGED
@@ -103,54 +103,30 @@ if 'key0' in st.session_state:
103
 
104
  if topic == 'Vulnerability':
105
 
106
- # Display charts
107
- col1, col2 = st.columns([1,1])
108
-
109
- # Pie chart
110
- with col1:
111
-
112
- # Create a df that stores all the labels
113
- df_labels = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
114
-
115
- # Count how often each label appears in the "Vulnerability Labels" column
116
- label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
117
- label_counts.columns = ['Label', 'Count']
118
-
119
- # Merge the label counts with the df_label DataFrame
120
- df_labels = df_labels.merge(label_counts, on='Label', how='left')
121
-
122
- # Configure graph
123
- fig = px.bar(df_labels,
124
- x="Label",
125
- y="Count",
126
- # color='Country',
127
- title='Label Counts',
128
- hover_name="Count",
129
- # color_discrete_sequence=px.colors.qualitative.Plotly
130
- )
131
-
132
- #Show plot
133
- st.plotly_chart(fig, use_container_width=True)
134
-
135
-
136
- # Bar cart
137
- with col2:
138
-
139
- # Configure graph
140
- fig = px.pie(df_labels,
141
- names="Label",
142
- values="Count",
143
- # color='Country',
144
- title='Label Counts',
145
- hover_name="Count",
146
- # color_discrete_sequence=px.colors.qualitative.Plotly
147
- )
148
-
149
- #Show plot
150
- st.plotly_chart(fig, use_container_width=True)
151
-
152
 
153
- # Display the table
154
  st.table(st.session_state['key0'])
155
 
156
  # vulnerability_analysis.vulnerability_display()
 
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
+ # Count how often each label appears in the "Vulnerability Labels" column
112
+ label_counts = st.session_state['key0']['Vulnerability Label'].value_counts().reset_index()
113
+ label_counts.columns = ['Label', 'Count']
114
+
115
+ # Merge the label counts with the df_label DataFrame
116
+ df_labels = df_labels.merge(label_counts, on='Label', how='left')
117
+
118
+ # Configure graph
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
+ #Show plot
127
+ st.plotly_chart(fig, use_container_width=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
129
+ ### Table
130
  st.table(st.session_state['key0'])
131
 
132
  # vulnerability_analysis.vulnerability_display()