Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +7 -7
src/streamlit_app.py
CHANGED
@@ -76,7 +76,7 @@ st.markdown(
|
|
76 |
# --- Page Configuration and UI Elements ---
|
77 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
78 |
|
79 |
-
st.subheader("ProductTag", divider="
|
80 |
st.link_button("by nlpblogs", "https://nlpblogs.com", type="tertiary")
|
81 |
|
82 |
expander = st.expander("**Important notes on the ProductTag**")
|
@@ -97,7 +97,7 @@ expander.write("""
|
|
97 |
""")
|
98 |
|
99 |
with st.sidebar:
|
100 |
-
st.subheader("Build your own NER Web App in a minute without writing a single line of code.", divider="
|
101 |
st.link_button("NER File Builder", "https://nlpblogs.com/shop/named-entity-recognition-ner/ner-file-builder/", type="primary")
|
102 |
|
103 |
st.text("")
|
@@ -196,7 +196,7 @@ if st.button("Results"):
|
|
196 |
experiment.log_parameter("input_text", text)
|
197 |
experiment.log_table("predicted_entities", df)
|
198 |
|
199 |
-
st.subheader("Extracted Entities", divider = "
|
200 |
st.dataframe(df.style.set_properties(**{"border": "2px solid gray", "color": "blue", "font-size": "16px"}))
|
201 |
|
202 |
with st.expander("See Glossary of tags"):
|
@@ -213,7 +213,7 @@ if st.button("Results"):
|
|
213 |
|
214 |
|
215 |
# Tree map
|
216 |
-
st.subheader("Tree map", divider = "
|
217 |
fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
|
218 |
fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25))
|
219 |
|
@@ -226,20 +226,20 @@ if st.button("Results"):
|
|
226 |
|
227 |
col1, col2 = st.columns(2)
|
228 |
with col1:
|
229 |
-
st.subheader("Pie chart", divider = "
|
230 |
fig_pie = px.pie(grouped_counts, values='count', names='category',
|
231 |
hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
|
232 |
fig_pie.update_traces(textposition='inside', textinfo='percent+label')
|
233 |
st.plotly_chart(fig_pie)
|
234 |
|
235 |
with col2:
|
236 |
-
st.subheader("Bar chart", divider = "
|
237 |
fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True,
|
238 |
title='Occurrences of predicted categories')
|
239 |
st.plotly_chart(fig_bar)
|
240 |
|
241 |
# Most Frequent Entities
|
242 |
-
st.subheader("Most Frequent Entities", divider="
|
243 |
word_counts = df['text'].value_counts().reset_index()
|
244 |
word_counts.columns = ['Entity', 'Count']
|
245 |
repeating_entities = word_counts[word_counts['Count'] > 1]
|
|
|
76 |
# --- Page Configuration and UI Elements ---
|
77 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
78 |
|
79 |
+
st.subheader("ProductTag", divider="gray")
|
80 |
st.link_button("by nlpblogs", "https://nlpblogs.com", type="tertiary")
|
81 |
|
82 |
expander = st.expander("**Important notes on the ProductTag**")
|
|
|
97 |
""")
|
98 |
|
99 |
with st.sidebar:
|
100 |
+
st.subheader("Build your own NER Web App in a minute without writing a single line of code.", divider="gray")
|
101 |
st.link_button("NER File Builder", "https://nlpblogs.com/shop/named-entity-recognition-ner/ner-file-builder/", type="primary")
|
102 |
|
103 |
st.text("")
|
|
|
196 |
experiment.log_parameter("input_text", text)
|
197 |
experiment.log_table("predicted_entities", df)
|
198 |
|
199 |
+
st.subheader("Extracted Entities", divider = "gray")
|
200 |
st.dataframe(df.style.set_properties(**{"border": "2px solid gray", "color": "blue", "font-size": "16px"}))
|
201 |
|
202 |
with st.expander("See Glossary of tags"):
|
|
|
213 |
|
214 |
|
215 |
# Tree map
|
216 |
+
st.subheader("Tree map", divider = "gray")
|
217 |
fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
|
218 |
fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25))
|
219 |
|
|
|
226 |
|
227 |
col1, col2 = st.columns(2)
|
228 |
with col1:
|
229 |
+
st.subheader("Pie chart", divider = "gray")
|
230 |
fig_pie = px.pie(grouped_counts, values='count', names='category',
|
231 |
hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
|
232 |
fig_pie.update_traces(textposition='inside', textinfo='percent+label')
|
233 |
st.plotly_chart(fig_pie)
|
234 |
|
235 |
with col2:
|
236 |
+
st.subheader("Bar chart", divider = "gray")
|
237 |
fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True,
|
238 |
title='Occurrences of predicted categories')
|
239 |
st.plotly_chart(fig_bar)
|
240 |
|
241 |
# Most Frequent Entities
|
242 |
+
st.subheader("Most Frequent Entities", divider="gray")
|
243 |
word_counts = df['text'].value_counts().reset_index()
|
244 |
word_counts.columns = ['Entity', 'Count']
|
245 |
repeating_entities = word_counts[word_counts['Count'] > 1]
|