Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +13 -7
src/streamlit_app.py
CHANGED
|
@@ -62,15 +62,21 @@ st.markdown(
|
|
| 62 |
|
| 63 |
# --- Page Configuration and UI Elements ---
|
| 64 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
| 65 |
-
st.subheader("HR.ai", divider="
|
| 66 |
st.link_button("by nlpblogs", "https://nlpblogs.com", type="tertiary")
|
| 67 |
expander = st.expander("**Important notes**")
|
| 68 |
expander.write("""**Named Entities:** This HR.ai predicts sixty (60) labels:"Email", "Phone_number", "Street_address", "City", "State", "Zip_code", "Country", "Date_of_birth", "Gender", "Marital_status", "Person", "Full_time", "Part_time", "Contract", "Temporary", "Terminated", "Active", "Retired", "Job_title", "Employment_type", "Year", "Date", "Company", "Organization", "Role", "Position","Performance_review", "Performance_rating", "Performance_score", "Sick_days", "Vacation_days", "Leave_of_absence", "Holidays", "Pension", "Retirement_plan", "Bonus", "Stock_options", "Health_insurance", "Retire_date", "Pay_rate", "Hourly_wage", "Annual_salary", "Overtime_pay", "Tax", "Social_security", "Deductions", "Job_posting", "Job_description", "Interview_type", "Applicant", "Candidate", "Referral", "Job_board", "Recruiter","Contract", "Offer_letter", "Agreement", "Training_course", "Certification", "Skill"
|
|
|
|
| 69 |
Results are presented in easy-to-read tables, visualized in an interactive tree map, pie chart and bar chart, and are available for download along with a Glossary of tags.
|
|
|
|
| 70 |
**How to Use:** Type or paste your text into the text area below, then press Ctrl + Enter. Click the 'Results' button to extract and tag entities in your text data.
|
|
|
|
| 71 |
**Usage Limits:** You can request results unlimited times for one (1) month.
|
|
|
|
| 72 |
**Supported Languages:** English, German, French, Italian, Spanish, Portuguese
|
|
|
|
| 73 |
**Technical issues:** If your connection times out, please refresh the page or reopen the app's URL.
|
|
|
|
| 74 |
For any errors or inquiries, please contact us at [email protected]""")
|
| 75 |
|
| 76 |
with st.sidebar:
|
|
@@ -87,7 +93,7 @@ with st.sidebar:
|
|
| 87 |
st.text("")
|
| 88 |
st.text("")
|
| 89 |
st.divider()
|
| 90 |
-
st.subheader("Ready to build your own NER Web App?
|
| 91 |
st.link_button("NER Builder", "https://nlpblogs.com", type="primary")
|
| 92 |
|
| 93 |
# --- Comet ML Setup ---
|
|
@@ -163,7 +169,7 @@ if st.button("Results"):
|
|
| 163 |
experiment.log_parameter("input_text", text)
|
| 164 |
experiment.log_table("predicted_entities", df)
|
| 165 |
|
| 166 |
-
st.subheader("
|
| 167 |
|
| 168 |
# Create tabs for each category
|
| 169 |
category_names = sorted(list(category_mapping.keys()))
|
|
@@ -191,7 +197,7 @@ if st.button("Results"):
|
|
| 191 |
st.divider()
|
| 192 |
|
| 193 |
# Tree map
|
| 194 |
-
st.subheader("Tree map", divider = "
|
| 195 |
fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
|
| 196 |
fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25), paper_bgcolor='#F5FFFA', plot_bgcolor='#F5FFFA')
|
| 197 |
st.plotly_chart(fig_treemap)
|
|
@@ -202,7 +208,7 @@ if st.button("Results"):
|
|
| 202 |
col1, col2 = st.columns(2)
|
| 203 |
|
| 204 |
with col1:
|
| 205 |
-
st.subheader("Pie chart", divider = "
|
| 206 |
fig_pie = px.pie(grouped_counts, values='count', names='category', hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
|
| 207 |
fig_pie.update_traces(textposition='inside', textinfo='percent+label')
|
| 208 |
fig_pie.update_layout(
|
|
@@ -212,7 +218,7 @@ if st.button("Results"):
|
|
| 212 |
st.plotly_chart(fig_pie)
|
| 213 |
|
| 214 |
with col2:
|
| 215 |
-
st.subheader("Bar chart", divider = "
|
| 216 |
fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True, title='Occurrences of predicted categories')
|
| 217 |
fig_pie.update_layout(
|
| 218 |
paper_bgcolor='#F5FFFA',
|
|
@@ -221,7 +227,7 @@ if st.button("Results"):
|
|
| 221 |
st.plotly_chart(fig_bar)
|
| 222 |
|
| 223 |
# Most Frequent Entities
|
| 224 |
-
st.subheader("Most Frequent Entities", divider="
|
| 225 |
word_counts = df['text'].value_counts().reset_index()
|
| 226 |
word_counts.columns = ['Entity', 'Count']
|
| 227 |
repeating_entities = word_counts[word_counts['Count'] > 1]
|
|
|
|
| 62 |
|
| 63 |
# --- Page Configuration and UI Elements ---
|
| 64 |
st.set_page_config(layout="wide", page_title="Named Entity Recognition App")
|
| 65 |
+
st.subheader("HR.ai", divider="green")
|
| 66 |
st.link_button("by nlpblogs", "https://nlpblogs.com", type="tertiary")
|
| 67 |
expander = st.expander("**Important notes**")
|
| 68 |
expander.write("""**Named Entities:** This HR.ai predicts sixty (60) labels:"Email", "Phone_number", "Street_address", "City", "State", "Zip_code", "Country", "Date_of_birth", "Gender", "Marital_status", "Person", "Full_time", "Part_time", "Contract", "Temporary", "Terminated", "Active", "Retired", "Job_title", "Employment_type", "Year", "Date", "Company", "Organization", "Role", "Position","Performance_review", "Performance_rating", "Performance_score", "Sick_days", "Vacation_days", "Leave_of_absence", "Holidays", "Pension", "Retirement_plan", "Bonus", "Stock_options", "Health_insurance", "Retire_date", "Pay_rate", "Hourly_wage", "Annual_salary", "Overtime_pay", "Tax", "Social_security", "Deductions", "Job_posting", "Job_description", "Interview_type", "Applicant", "Candidate", "Referral", "Job_board", "Recruiter","Contract", "Offer_letter", "Agreement", "Training_course", "Certification", "Skill"
|
| 69 |
+
|
| 70 |
Results are presented in easy-to-read tables, visualized in an interactive tree map, pie chart and bar chart, and are available for download along with a Glossary of tags.
|
| 71 |
+
|
| 72 |
**How to Use:** Type or paste your text into the text area below, then press Ctrl + Enter. Click the 'Results' button to extract and tag entities in your text data.
|
| 73 |
+
|
| 74 |
**Usage Limits:** You can request results unlimited times for one (1) month.
|
| 75 |
+
|
| 76 |
**Supported Languages:** English, German, French, Italian, Spanish, Portuguese
|
| 77 |
+
|
| 78 |
**Technical issues:** If your connection times out, please refresh the page or reopen the app's URL.
|
| 79 |
+
|
| 80 |
For any errors or inquiries, please contact us at [email protected]""")
|
| 81 |
|
| 82 |
with st.sidebar:
|
|
|
|
| 93 |
st.text("")
|
| 94 |
st.text("")
|
| 95 |
st.divider()
|
| 96 |
+
st.subheader("π Ready to build your own NER Web App?", divider="green")
|
| 97 |
st.link_button("NER Builder", "https://nlpblogs.com", type="primary")
|
| 98 |
|
| 99 |
# --- Comet ML Setup ---
|
|
|
|
| 169 |
experiment.log_parameter("input_text", text)
|
| 170 |
experiment.log_table("predicted_entities", df)
|
| 171 |
|
| 172 |
+
st.subheader("Grouped Entities by Category", divider = "green")
|
| 173 |
|
| 174 |
# Create tabs for each category
|
| 175 |
category_names = sorted(list(category_mapping.keys()))
|
|
|
|
| 197 |
st.divider()
|
| 198 |
|
| 199 |
# Tree map
|
| 200 |
+
st.subheader("Tree map", divider = "green")
|
| 201 |
fig_treemap = px.treemap(df, path=[px.Constant("all"), 'category', 'label', 'text'], values='score', color='category')
|
| 202 |
fig_treemap.update_layout(margin=dict(t=50, l=25, r=25, b=25), paper_bgcolor='#F5FFFA', plot_bgcolor='#F5FFFA')
|
| 203 |
st.plotly_chart(fig_treemap)
|
|
|
|
| 208 |
col1, col2 = st.columns(2)
|
| 209 |
|
| 210 |
with col1:
|
| 211 |
+
st.subheader("Pie chart", divider = "green")
|
| 212 |
fig_pie = px.pie(grouped_counts, values='count', names='category', hover_data=['count'], labels={'count': 'count'}, title='Percentage of predicted categories')
|
| 213 |
fig_pie.update_traces(textposition='inside', textinfo='percent+label')
|
| 214 |
fig_pie.update_layout(
|
|
|
|
| 218 |
st.plotly_chart(fig_pie)
|
| 219 |
|
| 220 |
with col2:
|
| 221 |
+
st.subheader("Bar chart", divider = "green")
|
| 222 |
fig_bar = px.bar(grouped_counts, x="count", y="category", color="category", text_auto=True, title='Occurrences of predicted categories')
|
| 223 |
fig_pie.update_layout(
|
| 224 |
paper_bgcolor='#F5FFFA',
|
|
|
|
| 227 |
st.plotly_chart(fig_bar)
|
| 228 |
|
| 229 |
# Most Frequent Entities
|
| 230 |
+
st.subheader("Most Frequent Entities", divider="green")
|
| 231 |
word_counts = df['text'].value_counts().reset_index()
|
| 232 |
word_counts.columns = ['Entity', 'Count']
|
| 233 |
repeating_entities = word_counts[word_counts['Count'] > 1]
|