Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import appStore.vulnerability_analysis as vulnerability_analysis
|
|
| 2 |
import appStore.doc_processing as processing
|
| 3 |
from utils.uploadAndExample import add_upload
|
| 4 |
import streamlit as st
|
|
|
|
| 5 |
|
| 6 |
st.set_page_config(page_title = 'Vulnerability Analysis',
|
| 7 |
initial_sidebar_state='expanded', layout="wide")
|
|
@@ -105,11 +106,23 @@ if 'key0' in st.session_state:
|
|
| 105 |
|
| 106 |
# Pie chart
|
| 107 |
with col1:
|
|
|
|
| 108 |
print(type(st.session_state['key0']))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
-
bar_data = st.session_state['key0']
|
| 111 |
|
| 112 |
-
# fig = px.bar(
|
| 113 |
# x="Year",
|
| 114 |
# y="Value",
|
| 115 |
# color='Country',
|
|
|
|
| 2 |
import appStore.doc_processing as processing
|
| 3 |
from utils.uploadAndExample import add_upload
|
| 4 |
import streamlit as st
|
| 5 |
+
from utils.vulnerability_classifier import label_dict
|
| 6 |
|
| 7 |
st.set_page_config(page_title = 'Vulnerability Analysis',
|
| 8 |
initial_sidebar_state='expanded', layout="wide")
|
|
|
|
| 106 |
|
| 107 |
# Pie chart
|
| 108 |
with col1:
|
| 109 |
+
|
| 110 |
print(type(st.session_state['key0']))
|
| 111 |
+
|
| 112 |
+
# Create a df that stores how often the labels appear
|
| 113 |
+
df_count = 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 Labels'].value_counts().reset_index()
|
| 117 |
+
label_counts.columns = ['Label', 'Count']
|
| 118 |
+
|
| 119 |
+
# Merge the label counts with the df_label DataFrame
|
| 120 |
+
df_label = df_label.merge(label_counts, on='Label', how='left')
|
| 121 |
+
st.write(df_label)
|
| 122 |
+
#bar_data = st.session_state['key0']
|
| 123 |
|
|
|
|
| 124 |
|
| 125 |
+
# fig = px.bar(st.session_state['key0'],
|
| 126 |
# x="Year",
|
| 127 |
# y="Value",
|
| 128 |
# color='Country',
|