Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +155 -54
pages/Data Collection.py
CHANGED
|
@@ -26,39 +26,57 @@ st.markdown("""
|
|
| 26 |
</style>
|
| 27 |
""", unsafe_allow_html=True)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Ensure session state for page tracking is initialized
|
| 30 |
if "current_page" not in st.session_state:
|
| 31 |
st.session_state.current_page = "main"
|
| 32 |
|
| 33 |
-
#
|
| 34 |
def navigate_to(page_name):
|
| 35 |
st.session_state.current_page = page_name
|
| 36 |
|
| 37 |
# Main Page
|
| 38 |
if st.session_state.current_page == "main":
|
|
|
|
| 39 |
st.markdown("""
|
| 40 |
<div style="text-align: left; margin-top: 20px;">
|
| 41 |
-
<h2 style="color: #BB3385;">What is Data
|
| 42 |
</div>
|
| 43 |
""", unsafe_allow_html=True)
|
| 44 |
|
|
|
|
| 45 |
st.write("""
|
| 46 |
**Data** is the measurements that are collected as a source of Information.
|
| 47 |
-
It refers
|
| 48 |
-
It has no meaning on its own until it is organized or analyzed to derive useful information.
|
| 49 |
-
""")
|
| 50 |
|
|
|
|
| 51 |
st.markdown("""
|
| 52 |
<div style="text-align: left; margin-top: 20px;">
|
| 53 |
<h2 style="color: #2a52be;">Types of Data</h2>
|
| 54 |
</div>
|
| 55 |
""", unsafe_allow_html=True)
|
| 56 |
|
|
|
|
| 57 |
data_type = st.radio(
|
| 58 |
"Select the type of Data:",
|
| 59 |
("Structured Data", "Unstructured Data", "Semi-Structured Data")
|
| 60 |
)
|
| 61 |
|
|
|
|
| 62 |
if data_type == "Structured Data":
|
| 63 |
st.markdown("""
|
| 64 |
<div style="text-align: left; margin-top: 20px;">
|
|
@@ -66,17 +84,60 @@ if st.session_state.current_page == "main":
|
|
| 66 |
</div>
|
| 67 |
""", unsafe_allow_html=True)
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
st.write("""
|
| 70 |
**Structured data** refers to information that is organized and formatted in a predefined manner, making it easy to store, retrieve, and analyze.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
""")
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
st.write("""
|
| 74 |
-
|
| 75 |
""")
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
if st.button("Explore Excel"):
|
| 78 |
navigate_to("explore_excel")
|
|
|
|
|
|
|
| 79 |
|
|
|
|
| 80 |
elif data_type == "Unstructured Data":
|
| 81 |
st.markdown("""
|
| 82 |
<div style="text-align: left; margin-top: 20px;">
|
|
@@ -84,18 +145,28 @@ if st.session_state.current_page == "main":
|
|
| 84 |
</div>
|
| 85 |
""", unsafe_allow_html=True)
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
st.write("""
|
| 88 |
**Unstructured data** refers to information that does not follow a predefined format or structure.
|
| 89 |
-
It
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
st.write("""
|
| 93 |
-
Click below to explore unstructured data formats:
|
| 94 |
""")
|
| 95 |
|
|
|
|
| 96 |
if st.button("Explore Images"):
|
| 97 |
navigate_to("explore_images")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
|
|
|
| 99 |
elif data_type == "Semi-Structured Data":
|
| 100 |
st.markdown("""
|
| 101 |
<div style="text-align: left; margin-top: 20px;">
|
|
@@ -103,81 +174,111 @@ if st.session_state.current_page == "main":
|
|
| 103 |
</div>
|
| 104 |
""", unsafe_allow_html=True)
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
st.write("""
|
| 107 |
**Semi-Structured data** refers to information that does not follow a strict tabular format but contains tags or markers to separate data elements.
|
| 108 |
-
|
| 109 |
-
""")
|
| 110 |
-
|
| 111 |
-
st.write("""
|
| 112 |
-
Click below to explore semi-structured data formats:
|
| 113 |
""")
|
| 114 |
|
|
|
|
| 115 |
if st.button("Explore JSON"):
|
| 116 |
navigate_to("explore_json")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
-
#
|
| 119 |
elif st.session_state.current_page == "explore_excel":
|
| 120 |
st.markdown("""
|
| 121 |
-
<
|
| 122 |
-
<h3 style="color: #e25822;">Exploring Excel</h3>
|
| 123 |
-
</div>
|
| 124 |
""", unsafe_allow_html=True)
|
| 125 |
-
|
| 126 |
st.write("""
|
| 127 |
-
Excel is
|
| 128 |
-
- Tabular data representation.
|
| 129 |
-
- Complex computations using formulas.
|
| 130 |
-
- Data visualization with charts and graphs.
|
| 131 |
""")
|
|
|
|
|
|
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
st.error("An error occurred while reading the file. Please ensure it is a valid Excel file.")
|
| 141 |
-
|
| 142 |
if st.button("Go Back"):
|
| 143 |
navigate_to("main")
|
| 144 |
|
| 145 |
-
# Images Page
|
| 146 |
elif st.session_state.current_page == "explore_images":
|
| 147 |
st.markdown("""
|
| 148 |
-
<
|
| 149 |
-
<h3 style="color: #e25822;">Exploring Images</h3>
|
| 150 |
-
</div>
|
| 151 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
st.write("""
|
| 154 |
-
|
| 155 |
-
Common formats include JPEG, PNG, and BMP.
|
| 156 |
""")
|
|
|
|
|
|
|
| 157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
if st.button("Go Back"):
|
| 159 |
navigate_to("main")
|
| 160 |
|
| 161 |
-
|
| 162 |
-
elif st.session_state.current_page == "explore_json":
|
| 163 |
st.markdown("""
|
| 164 |
-
<
|
| 165 |
-
<h3 style="color: #e25822;">Exploring JSON</h3>
|
| 166 |
-
</div>
|
| 167 |
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
st.write("""
|
| 170 |
-
JSON
|
| 171 |
-
It is easy for humans to read and write and easy for machines to parse and generate.
|
| 172 |
""")
|
|
|
|
|
|
|
| 173 |
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
"
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
"""
|
|
|
|
|
|
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
if st.button("Go Back"):
|
| 183 |
navigate_to("main")
|
|
|
|
| 26 |
</style>
|
| 27 |
""", unsafe_allow_html=True)
|
| 28 |
|
| 29 |
+
st.markdown(
|
| 30 |
+
"""
|
| 31 |
+
<style>
|
| 32 |
+
.stApp {
|
| 33 |
+
background-image: url("https://huggingface.co/spaces/LakshmiHarika/MachineLearning/resolve/main/DALL%C2%B7E%202024-12-03%2023.34.47%20-%20A%20simple%20and%20elegant%20background%20image%20for%20an%20AI-themed%20web%20application.%20The%20background%20should%20feature%20a%20soft%20gradient%20transitioning%20from%20white%20to%20ligh.webp");
|
| 34 |
+
background-size: cover;
|
| 35 |
+
background-repeat: no-repeat;
|
| 36 |
+
background-attachment: fixed;
|
| 37 |
+
}
|
| 38 |
+
</style>
|
| 39 |
+
""",
|
| 40 |
+
unsafe_allow_html=True
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
# Ensure session state for page tracking is initialized
|
| 44 |
if "current_page" not in st.session_state:
|
| 45 |
st.session_state.current_page = "main"
|
| 46 |
|
| 47 |
+
# Navigation function
|
| 48 |
def navigate_to(page_name):
|
| 49 |
st.session_state.current_page = page_name
|
| 50 |
|
| 51 |
# Main Page
|
| 52 |
if st.session_state.current_page == "main":
|
| 53 |
+
# Page Title
|
| 54 |
st.markdown("""
|
| 55 |
<div style="text-align: left; margin-top: 20px;">
|
| 56 |
+
<h2 style="color: #BB3385;">What is Data?📊✨</h2>
|
| 57 |
</div>
|
| 58 |
""", unsafe_allow_html=True)
|
| 59 |
|
| 60 |
+
# Introduction Text
|
| 61 |
st.write("""
|
| 62 |
**Data** is the measurements that are collected as a source of Information.
|
| 63 |
+
It refers raw facts, figures, and observations that can be collected, stored, and processed.
|
| 64 |
+
It has no meaning on its own until it is organized or analyzed to derive useful information.""")
|
|
|
|
| 65 |
|
| 66 |
+
# Types of Data Section
|
| 67 |
st.markdown("""
|
| 68 |
<div style="text-align: left; margin-top: 20px;">
|
| 69 |
<h2 style="color: #2a52be;">Types of Data</h2>
|
| 70 |
</div>
|
| 71 |
""", unsafe_allow_html=True)
|
| 72 |
|
| 73 |
+
# Radio Button for Data Type Selection
|
| 74 |
data_type = st.radio(
|
| 75 |
"Select the type of Data:",
|
| 76 |
("Structured Data", "Unstructured Data", "Semi-Structured Data")
|
| 77 |
)
|
| 78 |
|
| 79 |
+
# Structured Data Content
|
| 80 |
if data_type == "Structured Data":
|
| 81 |
st.markdown("""
|
| 82 |
<div style="text-align: left; margin-top: 20px;">
|
|
|
|
| 84 |
</div>
|
| 85 |
""", unsafe_allow_html=True)
|
| 86 |
|
| 87 |
+
st.markdown("""
|
| 88 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 89 |
+
<h4 style="color: #5b2c6f;">Definition:</h4>
|
| 90 |
+
</div>
|
| 91 |
+
""", unsafe_allow_html=True)
|
| 92 |
st.write("""
|
| 93 |
**Structured data** refers to information that is organized and formatted in a predefined manner, making it easy to store, retrieve, and analyze.
|
| 94 |
+
It is typically stored in tabular formats like rows and columns, where each field contains a specific type of information.
|
| 95 |
+
""")
|
| 96 |
+
|
| 97 |
+
st.markdown("""
|
| 98 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 99 |
+
<h4 style="color: #5b2c6f;">Characteristics:</h4>
|
| 100 |
+
</div>
|
| 101 |
+
""", unsafe_allow_html=True)
|
| 102 |
+
st.write("""
|
| 103 |
+
- Follows a fixed schema.
|
| 104 |
+
- Can be easily searched using query languages like SQL.
|
| 105 |
+
- Suitable for quantitative analysis.
|
| 106 |
""")
|
| 107 |
|
| 108 |
+
st.markdown("""
|
| 109 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 110 |
+
<h4 style="color: #5b2c6f;">Examples:</h4>
|
| 111 |
+
</div>
|
| 112 |
+
""", unsafe_allow_html=True)
|
| 113 |
st.write("""
|
| 114 |
+
A database of students with fields like ID, name, age, and gender:
|
| 115 |
""")
|
| 116 |
|
| 117 |
+
student_data = {
|
| 118 |
+
"Id": [100, 101, 102, 103],
|
| 119 |
+
"Name": ["Lakshmi Harika", "Varshitha", "Hari Chandan", "Shamitha"],
|
| 120 |
+
"Age": [22, 23, 22, 23],
|
| 121 |
+
"Gender": ["Female", "Female", "Male", "Female"]
|
| 122 |
+
}
|
| 123 |
+
df = pd.DataFrame(student_data)
|
| 124 |
+
st.markdown(df.style.set_table_styles(
|
| 125 |
+
[{'selector': 'thead th', 'props': 'font-weight: bold;'}]
|
| 126 |
+
).hide(axis="index").to_html(), unsafe_allow_html=True)
|
| 127 |
+
|
| 128 |
+
st.markdown("""
|
| 129 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 130 |
+
<h4 style="color: #5b2c6f;">Data Formats in Structured Data:</h4>
|
| 131 |
+
</div>
|
| 132 |
+
""", unsafe_allow_html=True)
|
| 133 |
+
|
| 134 |
+
st.write("Click to explore Structured Data Formats:")
|
| 135 |
if st.button("Explore Excel"):
|
| 136 |
navigate_to("explore_excel")
|
| 137 |
+
if st.button("Explore CSV"):
|
| 138 |
+
navigate_to("explore_csv")
|
| 139 |
|
| 140 |
+
# Unstructured Data Content
|
| 141 |
elif data_type == "Unstructured Data":
|
| 142 |
st.markdown("""
|
| 143 |
<div style="text-align: left; margin-top: 20px;">
|
|
|
|
| 145 |
</div>
|
| 146 |
""", unsafe_allow_html=True)
|
| 147 |
|
| 148 |
+
st.markdown("""
|
| 149 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 150 |
+
<h4 style="color: #5b2c6f;">Definition:</h4>
|
| 151 |
+
</div>
|
| 152 |
+
""", unsafe_allow_html=True)
|
| 153 |
st.write("""
|
| 154 |
**Unstructured data** refers to information that does not follow a predefined format or structure.
|
| 155 |
+
It is typically raw data that lacks a clear, organized schema, making it harder to store and analyze using traditional tools.
|
| 156 |
+
Examples include multimedia files (images, videos, audio), emails, and social media posts.
|
|
|
|
|
|
|
|
|
|
| 157 |
""")
|
| 158 |
|
| 159 |
+
st.write("Click to explore Unstructured Data Formats:")
|
| 160 |
if st.button("Explore Images"):
|
| 161 |
navigate_to("explore_images")
|
| 162 |
+
if st.button("Explore Audio"):
|
| 163 |
+
navigate_to("explore_audio")
|
| 164 |
+
if st.button("Explore Video"):
|
| 165 |
+
navigate_to("explore_video")
|
| 166 |
+
if st.button("Explore Text"):
|
| 167 |
+
navigate_to("explore_text")
|
| 168 |
|
| 169 |
+
# Semi-Structured Data Content
|
| 170 |
elif data_type == "Semi-Structured Data":
|
| 171 |
st.markdown("""
|
| 172 |
<div style="text-align: left; margin-top: 20px;">
|
|
|
|
| 174 |
</div>
|
| 175 |
""", unsafe_allow_html=True)
|
| 176 |
|
| 177 |
+
st.markdown("""
|
| 178 |
+
<div style="text-align: left; margin-top: 20px;">
|
| 179 |
+
<h4 style="color: #5b2c6f;">Definition:</h4>
|
| 180 |
+
</div>
|
| 181 |
+
""", unsafe_allow_html=True)
|
| 182 |
st.write("""
|
| 183 |
**Semi-Structured data** refers to information that does not follow a strict tabular format but contains tags or markers to separate data elements.
|
| 184 |
+
This type of data is more flexible than structured data but still organized enough to allow for easier analysis than unstructured data.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
""")
|
| 186 |
|
| 187 |
+
st.write("Click to explore Semi-Structured Data Formats:")
|
| 188 |
if st.button("Explore JSON"):
|
| 189 |
navigate_to("explore_json")
|
| 190 |
+
if st.button("Explore XML"):
|
| 191 |
+
navigate_to("explore_xml")
|
| 192 |
+
if st.button("Explore HTML"):
|
| 193 |
+
navigate_to("explore_html")
|
| 194 |
|
| 195 |
+
# Pages for Each Format
|
| 196 |
elif st.session_state.current_page == "explore_excel":
|
| 197 |
st.markdown("""
|
| 198 |
+
<h3 style="color: #e25822;">Exploring Excel</h3>
|
|
|
|
|
|
|
| 199 |
""", unsafe_allow_html=True)
|
|
|
|
| 200 |
st.write("""
|
| 201 |
+
Excel is a tabular format used for structured data. Features include data storage, formulas, and charts.
|
|
|
|
|
|
|
|
|
|
| 202 |
""")
|
| 203 |
+
if st.button("Go Back"):
|
| 204 |
+
navigate_to("main")
|
| 205 |
|
| 206 |
+
elif st.session_state.current_page == "explore_csv":
|
| 207 |
+
st.markdown("""
|
| 208 |
+
<h3 style="color: #e25822;">Exploring CSV</h3>
|
| 209 |
+
""", unsafe_allow_html=True)
|
| 210 |
+
st.write("""
|
| 211 |
+
CSV is a simple text-based format where data fields are separated by commas.
|
| 212 |
+
""")
|
|
|
|
|
|
|
| 213 |
if st.button("Go Back"):
|
| 214 |
navigate_to("main")
|
| 215 |
|
|
|
|
| 216 |
elif st.session_state.current_page == "explore_images":
|
| 217 |
st.markdown("""
|
| 218 |
+
<h3 style="color: #e25822;">Exploring Images</h3>
|
|
|
|
|
|
|
| 219 |
""", unsafe_allow_html=True)
|
| 220 |
+
st.write("""
|
| 221 |
+
Images are unstructured data used for visual representation, e.g., JPEG or PNG.
|
| 222 |
+
""")
|
| 223 |
+
if st.button("Go Back"):
|
| 224 |
+
navigate_to("main")
|
| 225 |
|
| 226 |
+
elif st.session_state.current_page == "explore_audio":
|
| 227 |
+
st.markdown("""
|
| 228 |
+
<h3 style="color: #e25822;">Exploring Audio</h3>
|
| 229 |
+
""", unsafe_allow_html=True)
|
| 230 |
st.write("""
|
| 231 |
+
Audio formats include MP3 and WAV for storing sound.
|
|
|
|
| 232 |
""")
|
| 233 |
+
if st.button("Go Back"):
|
| 234 |
+
navigate_to("main")
|
| 235 |
|
| 236 |
+
elif st.session_state.current_page == "explore_video":
|
| 237 |
+
st.markdown("""
|
| 238 |
+
<h3 style="color: #e25822;">Exploring Video</h3>
|
| 239 |
+
""", unsafe_allow_html=True)
|
| 240 |
+
st.write("""
|
| 241 |
+
Video formats include MP4 and AVI for multimedia storage.
|
| 242 |
+
""")
|
| 243 |
if st.button("Go Back"):
|
| 244 |
navigate_to("main")
|
| 245 |
|
| 246 |
+
elif st.session_state.current_page == "explore_text":
|
|
|
|
| 247 |
st.markdown("""
|
| 248 |
+
<h3 style="color: #e25822;">Exploring Text</h3>
|
|
|
|
|
|
|
| 249 |
""", unsafe_allow_html=True)
|
| 250 |
+
st.write("""
|
| 251 |
+
Text includes unstructured data like emails or plain-text files.
|
| 252 |
+
""")
|
| 253 |
+
if st.button("Go Back"):
|
| 254 |
+
navigate_to("main")
|
| 255 |
|
| 256 |
+
elif st.session_state.current_page == "explore_json":
|
| 257 |
+
st.markdown("""
|
| 258 |
+
<h3 style="color: #e25822;">Exploring JSON</h3>
|
| 259 |
+
""", unsafe_allow_html=True)
|
| 260 |
st.write("""
|
| 261 |
+
JSON is a semi-structured format used for APIs and data exchange.
|
|
|
|
| 262 |
""")
|
| 263 |
+
if st.button("Go Back"):
|
| 264 |
+
navigate_to("main")
|
| 265 |
|
| 266 |
+
elif st.session_state.current_page == "explore_xml":
|
| 267 |
+
st.markdown("""
|
| 268 |
+
<h3 style="color: #e25822;">Exploring XML</h3>
|
| 269 |
+
""", unsafe_allow_html=True)
|
| 270 |
+
st.write("""
|
| 271 |
+
XML uses tags to structure semi-structured data.
|
| 272 |
+
""")
|
| 273 |
+
if st.button("Go Back"):
|
| 274 |
+
navigate_to("main")
|
| 275 |
|
| 276 |
+
elif st.session_state.current_page == "explore_html":
|
| 277 |
+
st.markdown("""
|
| 278 |
+
<h3 style="color: #e25822;">Exploring HTML</h3>
|
| 279 |
+
""", unsafe_allow_html=True)
|
| 280 |
+
st.write("""
|
| 281 |
+
HTML structures web pages using elements like <div> and <p>.
|
| 282 |
+
""")
|
| 283 |
if st.button("Go Back"):
|
| 284 |
navigate_to("main")
|