Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ st.title("NLP Theory Blog")
|
|
| 5 |
|
| 6 |
# Sidebar for navigation
|
| 7 |
st.sidebar.title("Navigation")
|
| 8 |
-
pages = ["Introduction to NLP", "NLP Techniques"]
|
| 9 |
page = st.sidebar.radio("Go to:", pages)
|
| 10 |
|
| 11 |
# Content for each page
|
|
@@ -41,14 +41,103 @@ elif page == "NLP Techniques":
|
|
| 41 |
These techniques are often used in combination to build sophisticated NLP applications.
|
| 42 |
""")
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
st.experimental_set_query_params(page=pages[0])
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
# Footer
|
| 54 |
st.sidebar.write("---")
|
|
|
|
| 5 |
|
| 6 |
# Sidebar for navigation
|
| 7 |
st.sidebar.title("Navigation")
|
| 8 |
+
pages = ["Introduction to NLP", "NLP Techniques", "NLP Life Cycle"]
|
| 9 |
page = st.sidebar.radio("Go to:", pages)
|
| 10 |
|
| 11 |
# Content for each page
|
|
|
|
| 41 |
These techniques are often used in combination to build sophisticated NLP applications.
|
| 42 |
""")
|
| 43 |
|
| 44 |
+
elif page == "NLP Life Cycle":
|
| 45 |
+
# NLP Life Cycle Page with Sub-navigation
|
| 46 |
+
st.header("NLP Life Cycle")
|
|
|
|
| 47 |
|
| 48 |
+
# Sidebar navigation for NLP Life Cycle sub-pages
|
| 49 |
+
life_cycle_pages = ["Problem Definition", "Data Collection", "Data Preprocessing", "Feature Engineering",
|
| 50 |
+
"Modeling", "Model Evaluation", "Model Optimization", "Model Deployment",
|
| 51 |
+
"Post-Deployment Maintenance", "End-User Interaction"]
|
| 52 |
+
life_cycle_page = st.sidebar.radio("Select a step in the NLP Life Cycle:", life_cycle_pages)
|
| 53 |
+
|
| 54 |
+
# Content for each sub-page of NLP Life Cycle
|
| 55 |
+
if life_cycle_page == "Problem Definition":
|
| 56 |
+
st.write("""
|
| 57 |
+
In this phase, the problem you're trying to solve with NLP is defined. Examples include:
|
| 58 |
+
- Sentiment analysis
|
| 59 |
+
- Named entity recognition (NER)
|
| 60 |
+
- Text classification
|
| 61 |
+
- Machine translation
|
| 62 |
+
- Language generation
|
| 63 |
+
""")
|
| 64 |
+
|
| 65 |
+
elif life_cycle_page == "Data Collection":
|
| 66 |
+
st.write("""
|
| 67 |
+
Gather relevant textual data. Sources include:
|
| 68 |
+
- Web scraping (e.g., using BeautifulSoup or Scrapy)
|
| 69 |
+
- APIs (e.g., Twitter API)
|
| 70 |
+
- Pre-existing datasets (e.g., Kaggle, UCI repositories)
|
| 71 |
+
- User-generated content (e.g., reviews, social media)
|
| 72 |
+
""")
|
| 73 |
+
|
| 74 |
+
elif life_cycle_page == "Data Preprocessing":
|
| 75 |
+
st.write("""
|
| 76 |
+
Prepare the data for modeling by performing tasks such as:
|
| 77 |
+
- Text cleaning (removing unnecessary characters, punctuation)
|
| 78 |
+
- Tokenization (splitting text into words/sentences)
|
| 79 |
+
- Stopword removal
|
| 80 |
+
- Stemming or lemmatization
|
| 81 |
+
- Part-of-speech tagging
|
| 82 |
+
""")
|
| 83 |
+
|
| 84 |
+
elif life_cycle_page == "Feature Engineering":
|
| 85 |
+
st.write("""
|
| 86 |
+
Convert text data into numerical form for model consumption:
|
| 87 |
+
- Bag of Words (BoW)
|
| 88 |
+
- TF-IDF (Term Frequency-Inverse Document Frequency)
|
| 89 |
+
- Word embeddings (Word2Vec, GloVe)
|
| 90 |
+
- Contextual embeddings (BERT, GPT)
|
| 91 |
+
""")
|
| 92 |
+
|
| 93 |
+
elif life_cycle_page == "Modeling":
|
| 94 |
+
st.write("""
|
| 95 |
+
Train machine learning or deep learning models using the preprocessed text data:
|
| 96 |
+
- Supervised learning (e.g., Logistic Regression, SVM)
|
| 97 |
+
- Unsupervised learning (e.g., K-means clustering)
|
| 98 |
+
- Deep learning (e.g., RNNs, LSTMs, BERT)
|
| 99 |
+
""")
|
| 100 |
+
|
| 101 |
+
elif life_cycle_page == "Model Evaluation":
|
| 102 |
+
st.write("""
|
| 103 |
+
Evaluate the model's performance using metrics like:
|
| 104 |
+
- Accuracy
|
| 105 |
+
- Precision, Recall, F1-Score
|
| 106 |
+
- Confusion Matrix
|
| 107 |
+
- Cross-validation
|
| 108 |
+
""")
|
| 109 |
+
|
| 110 |
+
elif life_cycle_page == "Model Optimization":
|
| 111 |
+
st.write("""
|
| 112 |
+
Improve model performance by:
|
| 113 |
+
- Hyperparameter tuning (e.g., grid search)
|
| 114 |
+
- Regularization (e.g., L2 regularization, dropout)
|
| 115 |
+
- Ensemble methods (e.g., Random Forest, XGBoost)
|
| 116 |
+
""")
|
| 117 |
+
|
| 118 |
+
elif life_cycle_page == "Model Deployment":
|
| 119 |
+
st.write("""
|
| 120 |
+
Deploy the trained model into production:
|
| 121 |
+
- Expose the model via APIs (using Flask or FastAPI)
|
| 122 |
+
- Integrate with applications (e.g., chatbots, recommendation systems)
|
| 123 |
+
- Monitor the model's performance
|
| 124 |
+
""")
|
| 125 |
+
|
| 126 |
+
elif life_cycle_page == "Post-Deployment Maintenance":
|
| 127 |
+
st.write("""
|
| 128 |
+
Keep the model updated with new data:
|
| 129 |
+
- Retraining the model with fresh data
|
| 130 |
+
- Error analysis and model refinement
|
| 131 |
+
- Collecting user feedback for continuous improvement
|
| 132 |
+
""")
|
| 133 |
+
|
| 134 |
+
elif life_cycle_page == "End-User Interaction":
|
| 135 |
+
st.write("""
|
| 136 |
+
Present the model's results in an understandable way:
|
| 137 |
+
- Data visualization (e.g., charts, word clouds)
|
| 138 |
+
- Interactive dashboards (e.g., using Streamlit or Dash)
|
| 139 |
+
- Interface design (e.g., web or mobile apps)
|
| 140 |
+
""")
|
| 141 |
|
| 142 |
# Footer
|
| 143 |
st.sidebar.write("---")
|