AIEcosystem commited on
Commit
3df04ae
·
verified ·
1 Parent(s): b8cd831

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +37 -4
src/streamlit_app.py CHANGED
@@ -67,7 +67,28 @@ st.markdown(
67
  """,
68
  unsafe_allow_html=True)
69
  expander = st.expander("**Important notes**")
70
- expander.write(""" **How to Use the HR.ai web app:** 1. Type or paste your text into the text area, then press Ctrl + Enter.2. Click the 'Results' button to extract and tag entities in your text data. 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. **How to Use the Question-Answering feature:**1. Type or paste your text into the text area, then press Ctrl + Enter. 2. Click the 'Add Question' button to add your question to the Record of Questions. You can manage your questions by deleting them one by one.3. Click the 'Extract Answers' button to extract the answer to your question.Results are presented in an easy-to-read table, visualized in an interactive tree map, and is available for download. **Entities:** "Email", "Phone_number", "Street_address", "City", "Country", "Date_of_birth", "Marital_status", "Person", "Full_time", "Part_time", "Contract", "Terminated", "Retired", "Job_title", "Date", "Organization", "Role", "Performance_score", "Leave_of_absence", "Retirement_plan", "Bonus", "Stock_options", "Health_insurance", "Pay_rate", "Annual_salary", "Tax", "Deductions", "Interview_type", "Applicant", "Referral", "Job_board", "Recruiter", "Offer_letter", "Agreement", "Certification", "Skill"**Usage Limits:** You can request results unlimited times for one (1) month. **Supported Languages:** English **Technical issues:** If your connection times out, please refresh the page or reopen the app's URL. For any errors or inquiries, please contact us at info@nlpblogs.com""")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  with st.sidebar:
72
  st.write("Use the following code to embed the web app on your website. Feel free to adjust the width and height values to fit your page.")
73
  code = '''
@@ -132,10 +153,10 @@ with tab1:
132
  # Load model for this tab
133
  model_hr = load_gliner_model("HR_AI")
134
 
135
- # Define the word limit
136
  word_limit = 200
137
 
138
- text = st.text_area("Type or paste your text below (max 200 words), and then press Ctrl + Enter", height=250, key='my_text_area_hr')
139
 
140
  # Calculate and display the word count
141
  word_count = len(text.split())
@@ -237,9 +258,19 @@ with tab1:
237
  with tab2:
238
  # Load model for this tab
239
  model_qa = load_gliner_model("InfoFinder")
240
- user_text = st.text_area("Type or paste your text below, and then press Ctrl + Enter", height=250, key='my_text_area_infofinder')
 
 
 
 
 
 
 
 
 
241
  def clear_text_qa():
242
  st.session_state['my_text_area_infofinder'] = ""
 
243
  st.button("Clear text", on_click=clear_text_qa, key="clear_qa")
244
  st.subheader("Question-Answering", divider="green")
245
  question_input = st.text_input("Ask wh-questions. **Wh-questions begin with what, when, where, who, whom, which, whose, why and how. We use them to ask for specific information.**")
@@ -269,6 +300,8 @@ with tab2:
269
  if st.button("Extract Answers"):
270
  if not user_text.strip():
271
  st.warning("Please enter some text to analyze.")
 
 
272
  elif not st.session_state.user_labels:
273
  st.warning("Please define at least one question.")
274
  else:
 
67
  """,
68
  unsafe_allow_html=True)
69
  expander = st.expander("**Important notes**")
70
+ expander.write(""" **How to Use the HR.ai web app:**
71
+
72
+ 1. Type or paste your text into the text area, then press Ctrl + Enter.
73
+ 2. Click the 'Results' button to extract and tag entities in your text data.
74
+ 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.
75
+
76
+ **How to Use the Question-Answering feature:**
77
+
78
+ 1. Type or paste your text into the text area, then press Ctrl + Enter.
79
+ 2. Click the 'Add Question' button to add your question to the Record of Questions. You can manage your questions by deleting them one by one.
80
+ 3. Click the 'Extract Answers' button to extract the answer to your question.
81
+
82
+ Results are presented in an easy-to-read table, visualized in an interactive tree map, and is available for download.
83
+
84
+ **Entities:** "Email", "Phone_number", "Street_address", "City", "Country", "Date_of_birth", "Marital_status", "Person", "Full_time", "Part_time", "Contract", "Terminated", "Retired", "Job_title", "Date", "Organization", "Role", "Performance_score", "Leave_of_absence", "Retirement_plan", "Bonus", "Stock_options", "Health_insurance", "Pay_rate", "Annual_salary", "Tax", "Deductions", "Interview_type", "Applicant", "Referral", "Job_board", "Recruiter", "Offer_letter", "Agreement", "Certification", "Skill"**Usage Limits:** You can request results unlimited times for one (1) month.
85
+
86
+ **Supported Languages:** English
87
+
88
+ **Technical issues:** If your connection times out, please refresh the page or reopen the app's URL.
89
+
90
+ For any errors or inquiries, please contact us at info@nlpblogs.com""")
91
+
92
  with st.sidebar:
93
  st.write("Use the following code to embed the web app on your website. Feel free to adjust the width and height values to fit your page.")
94
  code = '''
 
153
  # Load model for this tab
154
  model_hr = load_gliner_model("HR_AI")
155
 
156
+ # Define the word limit for this tab
157
  word_limit = 200
158
 
159
+ text = st.text_area(f"Type or paste your text below (max {word_limit} words), and then press Ctrl + Enter", height=250, key='my_text_area_hr')
160
 
161
  # Calculate and display the word count
162
  word_count = len(text.split())
 
258
  with tab2:
259
  # Load model for this tab
260
  model_qa = load_gliner_model("InfoFinder")
261
+
262
+ # Define the word limit for this tab
263
+ word_limit_qa = 500
264
+
265
+ user_text = st.text_area(f"Type or paste your text below (max {word_limit_qa} words), and then press Ctrl + Enter", height=250, key='my_text_area_infofinder')
266
+
267
+ # Calculate and display the word count
268
+ word_count_qa = len(user_text.split())
269
+ st.markdown(f"**Word count:** {word_count_qa}/{word_limit_qa}")
270
+
271
  def clear_text_qa():
272
  st.session_state['my_text_area_infofinder'] = ""
273
+
274
  st.button("Clear text", on_click=clear_text_qa, key="clear_qa")
275
  st.subheader("Question-Answering", divider="green")
276
  question_input = st.text_input("Ask wh-questions. **Wh-questions begin with what, when, where, who, whom, which, whose, why and how. We use them to ask for specific information.**")
 
300
  if st.button("Extract Answers"):
301
  if not user_text.strip():
302
  st.warning("Please enter some text to analyze.")
303
+ elif word_count_qa > word_limit_qa:
304
+ st.warning(f"Your text exceeds the {word_limit_qa} word limit. Please shorten it to continue.")
305
  elif not st.session_state.user_labels:
306
  st.warning("Please define at least one question.")
307
  else: