Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -103,20 +103,21 @@ if 'key0' in st.session_state:
|
|
103 |
|
104 |
if topic == 'Vulnerability':
|
105 |
|
106 |
-
# Assign dataframe
|
107 |
df_vul = st.session_state['key0']
|
108 |
|
109 |
# Header
|
110 |
-
st.subheader("Explore
|
111 |
|
112 |
# Text
|
113 |
num_paragraphs = len(df_vul['Vulnerability Label'])
|
114 |
-
num_references = df_vul[df_vul['Vulnerability Label'] != 'Other']
|
115 |
|
116 |
st.markdown(f"""<div style="text-align: justify;"> The document has a
|
117 |
total of <span style="color: red;">{num_paragraphs}</span> paragraphs.
|
118 |
In total, we found <span style="color: red;">{num_references}</span>
|
119 |
-
to vulnerable
|
|
|
120 |
|
121 |
|
122 |
### Pie chart
|
@@ -125,7 +126,7 @@ if 'key0' in st.session_state:
|
|
125 |
df_labels = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
126 |
|
127 |
# Count how often each label appears in the "Vulnerability Labels" column
|
128 |
-
label_counts =
|
129 |
label_counts.columns = ['Label', 'Count']
|
130 |
|
131 |
# Merge the label counts with the df_label DataFrame
|
@@ -144,7 +145,7 @@ if 'key0' in st.session_state:
|
|
144 |
st.plotly_chart(fig, use_container_width=True)
|
145 |
|
146 |
### Table
|
147 |
-
st.table(
|
148 |
|
149 |
# vulnerability_analysis.vulnerability_display()
|
150 |
# elif topic == 'Action':
|
|
|
103 |
|
104 |
if topic == 'Vulnerability':
|
105 |
|
106 |
+
# Assign dataframe a name
|
107 |
df_vul = st.session_state['key0']
|
108 |
|
109 |
# Header
|
110 |
+
st.subheader("Explore the references to vulnerable groups:")
|
111 |
|
112 |
# Text
|
113 |
num_paragraphs = len(df_vul['Vulnerability Label'])
|
114 |
+
num_references = len(df_vul[df_vul['Vulnerability Label'] != 'Other'])
|
115 |
|
116 |
st.markdown(f"""<div style="text-align: justify;"> The document has a
|
117 |
total of <span style="color: red;">{num_paragraphs}</span> paragraphs.
|
118 |
In total, we found <span style="color: red;">{num_references}</span>
|
119 |
+
paragraphs that contain a reference to a vulnerable group.
|
120 |
+
</div>""", unsafe_allow_html=True)
|
121 |
|
122 |
|
123 |
### Pie chart
|
|
|
126 |
df_labels = pd.DataFrame(list(label_dict.items()), columns=['Label ID', 'Label'])
|
127 |
|
128 |
# Count how often each label appears in the "Vulnerability Labels" column
|
129 |
+
label_counts = df_vul['Vulnerability Label'].value_counts().reset_index()
|
130 |
label_counts.columns = ['Label', 'Count']
|
131 |
|
132 |
# Merge the label counts with the df_label DataFrame
|
|
|
145 |
st.plotly_chart(fig, use_container_width=True)
|
146 |
|
147 |
### Table
|
148 |
+
st.table(df_vul[df_vul['Vulnerability Label'] != 'Other'])
|
149 |
|
150 |
# vulnerability_analysis.vulnerability_display()
|
151 |
# elif topic == 'Action':
|