AIEcosystem commited on
Commit
8c5e7d3
Β·
verified Β·
1 Parent(s): 829ccfb

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +14 -1
src/streamlit_app.py CHANGED
@@ -48,7 +48,7 @@ with st.sidebar:
48
  st.code(code, language="html")
49
  st.text("")
50
  st.text("")
51
- st.divider()
52
  st.subheader("πŸš€ Ready to build your own AI Web App?", divider="violet")
53
  st.link_button("AI Web App Builder", "https://nlpblogs.com/build-your-named-entity-recognition-app/", type="primary")
54
 
@@ -179,6 +179,9 @@ if st.session_state.show_results:
179
  st.subheader("Tree map", divider="violet")
180
  fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
181
  fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25))
 
 
 
182
  st.plotly_chart(fig_treemap)
183
 
184
  # Pie and Bar charts
@@ -190,11 +193,17 @@ if st.session_state.show_results:
190
  st.subheader("Pie chart", divider="violet")
191
  fig_pie = px.pie(grouped_counts, values='count', names='category', hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
192
  fig_pie.update_traces(textposition='inside', textinfo='percent+label')
 
 
 
193
  st.plotly_chart(fig_pie)
194
 
195
  with col2:
196
  st.subheader("Bar chart", divider="violet")
197
  fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True, title='Occurrences of predicted categories')
 
 
 
198
  st.plotly_chart(fig_bar)
199
 
200
  # Most Frequent Entities
@@ -207,6 +216,9 @@ if st.session_state.show_results:
207
  st.dataframe(repeating_entities, use_container_width=True)
208
  fig_repeating_bar = px.bar(repeating_entities, x='Entity', y='Count', color='Entity')
209
  fig_repeating_bar.update_layout(xaxis={'categoryorder': 'total descending'})
 
 
 
210
  st.plotly_chart(fig_repeating_bar)
211
  else:
212
  st.warning("No entities were found that occur more than once.")
@@ -219,6 +231,7 @@ if st.session_state.show_results:
219
  buf = io.BytesIO()
220
  with zipfile.ZipFile(buf, "w") as myzip:
221
  myzip.writestr("Summary of the results.csv", df.to_csv(index=False))
 
222
  myzip.writestr("Glossary of tags.csv", dfa.to_csv(index=False))
223
 
224
  with stylable_container(
 
48
  st.code(code, language="html")
49
  st.text("")
50
  st.text("")
51
+
52
  st.subheader("πŸš€ Ready to build your own AI Web App?", divider="violet")
53
  st.link_button("AI Web App Builder", "https://nlpblogs.com/build-your-named-entity-recognition-app/", type="primary")
54
 
 
179
  st.subheader("Tree map", divider="violet")
180
  fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
181
  fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25))
182
+ expander = st.expander("**Download**")
183
+ expander.write("""You can easily download the tree map by hovering over it. Look for the download icon that appears in the top right corner.
184
+ """)
185
  st.plotly_chart(fig_treemap)
186
 
187
  # Pie and Bar charts
 
193
  st.subheader("Pie chart", divider="violet")
194
  fig_pie = px.pie(grouped_counts, values='count', names='category', hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
195
  fig_pie.update_traces(textposition='inside', textinfo='percent+label')
196
+ expander = st.expander("**Download**")
197
+ expander.write("""You can easily download the pie chart by hovering over it. Look for the download icon that appears in the top right corner.
198
+ """)
199
  st.plotly_chart(fig_pie)
200
 
201
  with col2:
202
  st.subheader("Bar chart", divider="violet")
203
  fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True, title='Occurrences of predicted categories')
204
+ expander = st.expander("**Download**")
205
+ expander.write("""You can easily download the bar chart by hovering over it. Look for the download icon that appears in the top right corner.
206
+ """)
207
  st.plotly_chart(fig_bar)
208
 
209
  # Most Frequent Entities
 
216
  st.dataframe(repeating_entities, use_container_width=True)
217
  fig_repeating_bar = px.bar(repeating_entities, x='Entity', y='Count', color='Entity')
218
  fig_repeating_bar.update_layout(xaxis={'categoryorder': 'total descending'})
219
+ expander = st.expander("**Download**")
220
+ expander.write("""You can easily download the bar chart by hovering over it. Look for the download icon that appears in the top right corner.
221
+ """)
222
  st.plotly_chart(fig_repeating_bar)
223
  else:
224
  st.warning("No entities were found that occur more than once.")
 
231
  buf = io.BytesIO()
232
  with zipfile.ZipFile(buf, "w") as myzip:
233
  myzip.writestr("Summary of the results.csv", df.to_csv(index=False))
234
+ myzip.writestr("Most Frequent Entities.csv", repeating_entities.to_csv(index=False))
235
  myzip.writestr("Glossary of tags.csv", dfa.to_csv(index=False))
236
 
237
  with stylable_container(