Spaces:
Runtime error
Runtime error
Create 2.Life Cycle of NLP.py
Browse files- pages/2.Life Cycle of NLP.py +109 -0
pages/2.Life Cycle of NLP.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
|
| 3 |
+
import streamlit as st
|
| 4 |
+
|
| 5 |
+
st.markdown(
|
| 6 |
+
"""
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
background-color: #f9f9f9; /* Light gray background */
|
| 10 |
+
font-family: 'Arial', sans-serif;
|
| 11 |
+
}
|
| 12 |
+
@keyframes fadeIn {
|
| 13 |
+
0% { opacity: 0; transform: translateY(-20px); }
|
| 14 |
+
100% { opacity: 1; transform: translateY(0); }
|
| 15 |
+
}
|
| 16 |
+
.title {
|
| 17 |
+
text-align: center;
|
| 18 |
+
color: black
|
| 19 |
+
font-size: 3rem;
|
| 20 |
+
font-weight: bold;
|
| 21 |
+
animation: fadeIn 1s ease-in-out;
|
| 22 |
+
}
|
| 23 |
+
.caption {
|
| 24 |
+
text-align: center;
|
| 25 |
+
font-style: italic;
|
| 26 |
+
font-size: 1.2rem;
|
| 27 |
+
color: black
|
| 28 |
+
animation: fadeIn 1.5s ease-in-out;
|
| 29 |
+
}
|
| 30 |
+
.section {
|
| 31 |
+
font-size: 1.1rem;
|
| 32 |
+
text-align: justify;
|
| 33 |
+
line-height: 1.8;
|
| 34 |
+
color: #34495e; /* Muted gray */
|
| 35 |
+
background: #ffffff; /* White card-style background */
|
| 36 |
+
padding: 20px;
|
| 37 |
+
border-radius: 10px;
|
| 38 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
| 39 |
+
animation: fadeIn 2s ease-in-out;
|
| 40 |
+
margin: 10px 0;
|
| 41 |
+
}
|
| 42 |
+
.image-container {
|
| 43 |
+
text-align: center;
|
| 44 |
+
margin: 20px 0;
|
| 45 |
+
animation: fadeIn 2.5s ease-in-out;
|
| 46 |
+
}
|
| 47 |
+
.image-container img {
|
| 48 |
+
border-radius: 15px;
|
| 49 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 50 |
+
transition: transform 0.3s ease-in-out;
|
| 51 |
+
}
|
| 52 |
+
.image-container img:hover {
|
| 53 |
+
transform: scale(1.05); /* Subtle zoom effect */
|
| 54 |
+
}
|
| 55 |
+
.sidebar {
|
| 56 |
+
width: 200px;
|
| 57 |
+
}
|
| 58 |
+
</style>
|
| 59 |
+
""",
|
| 60 |
+
unsafe_allow_html=True,
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
st.sidebar.title("NLP Life Cycle Navigation")
|
| 64 |
+
step = st.sidebar.radio("Choose a step in NLP Life Cycle",
|
| 65 |
+
("Problem Statement", "Data Collection", "Simple EDA", "Data Pre-processing", "EDA",
|
| 66 |
+
"Feature Engineering", "Training", "Testing", "Deployment/Monitoring"))
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
st.title("**Life Cycle of NLP**")
|
| 70 |
+
st.caption("Navigating the journey of NLP from start to deployment!...")
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
st.markdown(
|
| 74 |
+
"""
|
| 75 |
+
<div class='image-container'>
|
| 76 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/66bde9bf3c885d04498227a0/5NnNw23wcvLOTXpNGCqbF.png" alt="NLP Image">
|
| 77 |
+
</div>
|
| 78 |
+
""",
|
| 79 |
+
unsafe_allow_html=True,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
if step == "Problem Statement":
|
| 84 |
+
st.markdown("<div class='section'><b>Problem Statement</b><br>Every NLP project begins by identifying the problem that needs solving. It could range from sentiment analysis to machine translation, based on the requirements.</div>", unsafe_allow_html=True)
|
| 85 |
+
|
| 86 |
+
elif step == "Data Collection":
|
| 87 |
+
st.markdown("<div class='section'><b>Data Collection</b><br>The next step is to gather relevant text data from various sources such as servers, web-scrapping(text).</div>", unsafe_allow_html=True)
|
| 88 |
+
|
| 89 |
+
elif step == "Simple EDA":
|
| 90 |
+
st.markdown("<div class='section'><b>Simple EDA</b><br>Before diving deep into modeling, it's crucial to understand the data. Simple EDA gives the quality of the collected text data.</div>", unsafe_allow_html=True)
|
| 91 |
+
|
| 92 |
+
elif step == "Data Pre-processing":
|
| 93 |
+
st.markdown("<div class='section'><b>Data Pre-processing</b><br>Pre-processing includes cleaning the data and pre-processing using different techniques based on the problem statement.</div>", unsafe_allow_html=True)
|
| 94 |
+
|
| 95 |
+
elif step == "EDA":
|
| 96 |
+
st.markdown("<div class='section'><b>EDA (Exploratory Data Analysis)</b><br>In this deeper phase of EDA, visualizations like word clouds, bar plots, and heatmaps are created to gain insights into the data. Identifying correlations, trends, and outliers is crucial here.</div>", unsafe_allow_html=True)
|
| 97 |
+
|
| 98 |
+
elif step == "Feature Engineering":
|
| 99 |
+
st.markdown("<div class='section'><b>Feature Engineering</b><br>Feature engineering involves creating new features or transforming existing ones to better represent the data for machine learning models.Convert text into numerical format(**Vectorization**)</div>", unsafe_allow_html=True)
|
| 100 |
+
|
| 101 |
+
elif step == "Training":
|
| 102 |
+
st.markdown("<div class='section'><b>Training</b><br>The model is trained using the pre-processed data.</div>", unsafe_allow_html=True)
|
| 103 |
+
|
| 104 |
+
elif step == "Testing":
|
| 105 |
+
st.markdown("<div class='section'><b>Testing</b><br>After training, the model is evaluated on a separate test dataset.</div>", unsafe_allow_html=True)
|
| 106 |
+
|
| 107 |
+
elif step == "Deployment/Monitoring":
|
| 108 |
+
st.markdown("<div class='section'><b>Deployment and Monitoring</b><br>Once the model is trained and tested, it is deployed into a real-world environment. Continuous monitoring is needed to ensure the model performs well over time, especially as new data comes in.</div>", unsafe_allow_html=True)
|
| 109 |
+
|