Update app.py
Browse files
app.py
CHANGED
|
@@ -18,20 +18,23 @@ if sidebar_option != st.session_state.selected_page:
|
|
| 18 |
st.session_state.selected_page = sidebar_option
|
| 19 |
|
| 20 |
# Dynamically update the title based on the selected option
|
|
|
|
|
|
|
|
|
|
| 21 |
if st.session_state.selected_page == 'What is NLP?':
|
| 22 |
-
|
| 23 |
|
| 24 |
elif st.session_state.selected_page == 'NLP Lifecycle':
|
| 25 |
-
|
| 26 |
if sidebar_option == 'Problem Definition':
|
| 27 |
st.title('π§ Steps in the Natural Language Processing (NLP) lifecycle:')
|
|
|
|
| 28 |
elif st.session_state.selected_page == 'NLP Techniques':
|
| 29 |
-
|
| 30 |
-
|
| 31 |
|
| 32 |
# Content for "What is NLP?"
|
| 33 |
if st.session_state.selected_page == 'What is NLP?':
|
| 34 |
-
st.markdown("<h2 style='text-align: center; color: black;'>
|
| 35 |
st.write("""
|
| 36 |
#### π€ What is NLP?
|
| 37 |
Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) that focuses on the interaction between computers and human (natural) languages. The goal of NLP is to enable machines to understand, interpret, and generate human language in a way that is meaningful.
|
|
@@ -184,22 +187,20 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 184 |
- **Precision**: The percentage of relevant instances among the retrieved instances.
|
| 185 |
- **Recall**: The percentage of relevant instances that were retrieved.
|
| 186 |
- **F1-score**: The harmonic mean of precision and recall.
|
| 187 |
-
|
| 188 |
-
**Example**:
|
| 189 |
""")
|
| 190 |
|
| 191 |
elif lifecycle_option == "Deployment":
|
| 192 |
st.write("""
|
| 193 |
#### π 7. Deployment
|
| 194 |
-
|
| 195 |
-
- **
|
| 196 |
-
- **
|
| 197 |
-
|
| 198 |
-
**Example**: Deploying a chatbot to answer customer inquiries based on historical support tickets.
|
| 199 |
-
""")
|
| 200 |
-
|
| 201 |
-
# Content for NLP Techniques
|
| 202 |
|
|
|
|
|
|
|
| 203 |
|
| 204 |
|
| 205 |
# Content for "NLP Techniques"
|
|
@@ -221,7 +222,7 @@ elif st.session_state.selected_page == "NLP Techniques":
|
|
| 221 |
st.write("""
|
| 222 |
### βοΈ Techniques in NLP
|
| 223 |
NLP uses a variety of techniques to process and analyze text data. Some of the most common techniques include:
|
| 224 |
-
|
| 225 |
1. **Tokenization**: Breaking down text into smaller units (e.g., words, sentences).
|
| 226 |
2. **Part-of-Speech (POS) Tagging**: Identifying the grammatical roles of words in a sentence (e.g., noun, verb, adjective).
|
| 227 |
3. **Named Entity Recognition (NER)**: Identifying entities such as names, dates, locations, etc.
|
|
|
|
| 18 |
st.session_state.selected_page = sidebar_option
|
| 19 |
|
| 20 |
# Dynamically update the title based on the selected option
|
| 21 |
+
def set_title(title, color="black"):
|
| 22 |
+
st.markdown(f"<h1 style='text-align: center; color: {color};'>{title}</h1>", unsafe_allow_html=True)
|
| 23 |
+
|
| 24 |
if st.session_state.selected_page == 'What is NLP?':
|
| 25 |
+
set_title('Natural Language Processing (NLP)')
|
| 26 |
|
| 27 |
elif st.session_state.selected_page == 'NLP Lifecycle':
|
| 28 |
+
set_title('π Natural Language Processing (NLP) Lifecycle')
|
| 29 |
if sidebar_option == 'Problem Definition':
|
| 30 |
st.title('π§ Steps in the Natural Language Processing (NLP) lifecycle:')
|
| 31 |
+
|
| 32 |
elif st.session_state.selected_page == 'NLP Techniques':
|
| 33 |
+
set_title('βοΈ Techniques in Natural Language Processing (NLP)')
|
|
|
|
| 34 |
|
| 35 |
# Content for "What is NLP?"
|
| 36 |
if st.session_state.selected_page == 'What is NLP?':
|
| 37 |
+
st.markdown("<h2 style='text-align: center; color: black;'>Introduction</h2>", unsafe_allow_html=True)
|
| 38 |
st.write("""
|
| 39 |
#### π€ What is NLP?
|
| 40 |
Natural Language Processing (NLP) is a subfield of artificial intelligence (AI) that focuses on the interaction between computers and human (natural) languages. The goal of NLP is to enable machines to understand, interpret, and generate human language in a way that is meaningful.
|
|
|
|
| 187 |
- **Precision**: The percentage of relevant instances among the retrieved instances.
|
| 188 |
- **Recall**: The percentage of relevant instances that were retrieved.
|
| 189 |
- **F1-score**: The harmonic mean of precision and recall.
|
| 190 |
+
|
| 191 |
+
**Example**: Evaluating a sentiment analysis model using accuracy and F1-score on a test dataset.
|
| 192 |
""")
|
| 193 |
|
| 194 |
elif lifecycle_option == "Deployment":
|
| 195 |
st.write("""
|
| 196 |
#### π 7. Deployment
|
| 197 |
+
Once the model is evaluated and tuned, it is deployed into production where it can be used by end users. Deployment involves:
|
| 198 |
+
- **Integration** with web applications, chatbots, or other tools.
|
| 199 |
+
- **API Development**: Exposing the model through an API for real-time predictions.
|
| 200 |
+
- **Continuous Monitoring**: Tracking the modelβs performance and retraining it as needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
+
**Example**: Deploying a sentiment analysis model in a customer service chatbot that analyzes customer inquiries in real time.
|
| 203 |
+
""")
|
| 204 |
|
| 205 |
|
| 206 |
# Content for "NLP Techniques"
|
|
|
|
| 222 |
st.write("""
|
| 223 |
### βοΈ Techniques in NLP
|
| 224 |
NLP uses a variety of techniques to process and analyze text data. Some of the most common techniques include:
|
| 225 |
+
### π οΈ Common NLP Techniques
|
| 226 |
1. **Tokenization**: Breaking down text into smaller units (e.g., words, sentences).
|
| 227 |
2. **Part-of-Speech (POS) Tagging**: Identifying the grammatical roles of words in a sentence (e.g., noun, verb, adjective).
|
| 228 |
3. **Named Entity Recognition (NER)**: Identifying entities such as names, dates, locations, etc.
|