Spaces:
Sleeping
Sleeping
File size: 16,820 Bytes
a874649 46a8214 dafd1b1 efd6661 dafd1b1 a874649 b87bd38 351f5db b87bd38 0762c0d 8264099 351f5db dc4fcbc e39ef65 351f5db e39ef65 351f5db e39ef65 351f5db e39ef65 351f5db 24ab87f 52ca991 39075cc 611ac6c bc21413 0762c0d 39075cc bc21413 da7de8b bc21413 39075cc bc21413 39075cc bc21413 0112993 39075cc bc21413 39075cc fec8420 39075cc bc21413 0112993 39075cc bc21413 4f180b3 21ccfde 39075cc 21ccfde 39075cc 21ccfde 39075cc 21ccfde 39075cc 21ccfde 39075cc bc21413 611ac6c bc21413 21ccfde bc21413 21ccfde bc21413 39075cc bc21413 39075cc 21ccfde 611ac6c 3df5436 a9e0847 39075cc ceb3493 39075cc 21ccfde bc21413 21ccfde bc21413 21ccfde 39075cc bc21413 39075cc bc21413 21ccfde 3df5436 611ac6c a9e0847 39075cc 611ac6c bc21413 39075cc 21ccfde 39075cc bc21413 4f180b3 39075cc 4f180b3 3df5436 81dd206 39075cc 81dd206 ceb3493 dc4fcbc 26518f6 ceb3493 3b694d5 8a8083f 49ad621 ceb3493 26518f6 bf18dc4 8a8083f dafd1b1 bf18dc4 3b694d5 8a8083f 49ad621 bf18dc4 3b694d5 8a8083f 3b694d5 bf18dc4 ceb3493 dc4fcbc 3b694d5 8a8083f 49ad621 3b694d5 8a8083f 3b694d5 8a8083f dafd1b1 8a8083f 3b694d5 8a8083f 3b694d5 49ad621 1a2abba 6d6d68e e1cfe74 6d6d68e 1a2abba 495565f e1cfe74 6708e46 6d6d68e 8a8083f 1a2abba 6d6d68e e1cfe74 495565f 6d6d68e 495565f 49ad621 e1cfe74 6708e46 1a2abba 6d6d68e 9380b05 3b694d5 39075cc 3271caa ceb3493 bf18dc4 3b694d5 39075cc 3271caa 39075cc 67c5513 39075cc 67c5513 e39ef65 39075cc dc4fcbc 39075cc dc4fcbc 39075cc 3271caa 611ac6c 39075cc 3271caa 39075cc 3271caa 39075cc 3271caa 39075cc e39ef65 39075cc bc21413 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 |
import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
st.set_page_config(
page_title="HomePage",
page_icon="🚀",
layout="wide"
)
# Global CSS for consistent styling across all pages
st.markdown("""
<style>
body, .stApp {
color: #4F4F4F; /* Replace with your desired font color */
background-color: #FFFFFF;
}
h1, h2, h3, h4, h5, h6 {
color: #BB3385;
}
p {
color: #4F4F4F;
}
ul li {
color: #4F4F4F;
}
</style>
""", unsafe_allow_html=True)
st.markdown(
"""
<style>
.stApp {
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");
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
</style>
""",
unsafe_allow_html=True
)
# Ensure session state for navigation
if "current_page" not in st.session_state:
st.session_state.current_page = "main"
# Navigation function
def navigate_to(page_name):
st.session_state.current_page = page_name
# Main Page
if st.session_state.current_page == "main":
# Page Title
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h2 style="color: #BB3385;">What is Data?📊✨</h2>
</div>
""", unsafe_allow_html=True)
# Introduction Text
st.write("""
**Data** is the measurements that are collected as a source of Information.
It refers raw facts, figures, and observations that can be collected, stored, and processed.
It has no meaning on its own until it is organized or analyzed to derive useful information.""")
# Types of Data Section
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h2 style="color: #2a52be;">Types of Data</h2>
</div>
""", unsafe_allow_html=True)
# Radio Button for Data Type Selection
data_type = st.radio(
"Select the type of Data:",
("Structured Data", "Unstructured Data", "Semi-Structured Data")
)
if data_type == "Structured Data":
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #e25822;">What is Structured Data?</h3>
</div>
""", unsafe_allow_html=True)
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Definition:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
**Structured data** refers to information that is organized and formatted in a predefined manner, making it easy to store, retrieve, and analyze.
It is typically stored in tabular formats like rows and columns, where each field contains a specific type of information.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Characteristics:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
- Follows a fixed schema.
- Can be easily searched using query languages like SQL.
- Suitable for quantitative analysis.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Examples:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
A database of students with fields like ID, name, age, and gender:
""")
student_data = {
"Id": [100, 101, 102, 103],
"Name": ["Lakshmi Harika", "Varshitha", "Hari Chandan", "Shamitha"],
"Age": [22, 23, 22, 23],
"Gender": ["Female", "Female", "Male", "Female"]
}
df = pd.DataFrame(student_data)
st.markdown(df.style.set_table_styles(
[{'selector': 'thead th', 'props': 'font-weight: bold;'}]
).hide(axis="index").to_html(), unsafe_allow_html=True)
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Data Formats in Structured Data:</h4>
</div>
""", unsafe_allow_html=True)
st.write("Click to explore Structured Data Formats:")
if st.button("Explore Excel"):
navigate_to("explore_excel")
elif data_type == "Unstructured Data":
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #e25822;">What is Unstructured Data?</h3>
</div>
""", unsafe_allow_html=True)
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Definition:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
**Unstructured data** refers to information that does not follow a predefined format or structure.
It is typically raw data that lacks a clear, organized schema, making it harder to store and analyze using traditional tools.
Examples include multimedia files (images, videos, audio), emails, and social media posts.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Characteristics:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
- Does not follow a specific schema or structure.
- Cannot be stored in traditional tabular formats like rows and columns.
- Requires advanced tools like machine learning or natural language processing (NLP) for analysis.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Examples:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
- **Images**: Photos, screenshots, or scanned documents.
- **Audio**: Podcasts, voice recordings, or music files.
- **Videos**: Recorded lectures, surveillance footage, or YouTube videos.
- **Text**: Emails, social media posts, and blog articles.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Data Formats in UnStructured Data:</h4>
</div>
""", unsafe_allow_html=True)
st.write("Click to explore Unstructured Data Formats:")
if st.button("Explore Images & Videos"):
navigate_to("explore_images_video")
if st.button("Explore Audio"):
navigate_to("explore_audio")
if st.button("Explore Text"):
navigate_to("explore_text")
elif data_type == "Semi-Structured Data":
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #e25822;">What is Semi-Structured Data?</h3>
</div>
""", unsafe_allow_html=True)
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Definition:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
**Semi-Structured data** refers to information that does not follow a strict tabular format but contains tags or markers to separate data elements.
This type of data is more flexible than structured data but still organized enough to allow for easier analysis than unstructured data.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Characteristics:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
- Contains markers or tags (e.g., XML, JSON keys) to provide structure.
- More flexible than structured data, allowing for varying schemas.
- Easier to process than unstructured data.
- Can store hierarchical relationships.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Examples:</h4>
</div>
""", unsafe_allow_html=True)
st.write("""
Examples of semi-structured data include:
- **CSV**: Comma-separated values in plain-text files.
- **JSON**: A lightweight data-interchange format used in web applications.
- **XML**: Extensible Markup Language for structured document encoding.
- **HTML**: Markup language for web pages.
""")
st.markdown("""
<div style="text-align: left; margin-top: 20px;">
<h4 style="color: #5b2c6f;">Data Formats in Semi-Structured Data:</h4>
</div>
""", unsafe_allow_html=True)
st.write("Click to explore Semi-Structured Data Formats:")
if st.button("Explore CSV"):
navigate_to("explore_csv")
if st.button("Explore JSON"):
navigate_to("explore_json")
if st.button("Explore XML"):
navigate_to("explore_xml")
if st.button("Explore HTML"):
navigate_to("explore_html")
# Pages for Each Format
elif st.session_state.current_page == "explore_excel":
st.markdown("""
<h3 style="color: #e25822;">Exploring Excel</h3>
""", unsafe_allow_html=True)
st.write("""
Excel is a structured data format used to store and analyze data in tabular form. It supports features like formulas, charts, and pivot tables.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_images_video":
st.markdown("""
<h2 style="color: #BB3385;">Introduction to Images and Videos📸🖼️</h2>
""", unsafe_allow_html=True)
# Subheading 1: What is an Image?
st.write("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #5b2c6f;">What is an Image?📊✨</h3>
<p style="font-size: 16px; color: #333;">
An image is a two-dimensional representation of the visible light spectrum, often captured
using devices like cameras or scanners. It can store details such as <strong>colors</strong>, <strong>shapes</strong>, and <strong>textures</strong>,
enabling us to visually interpret and analyze information.
Common formats include JPEG, PNG, and BMP.
</p>
</div>
""", unsafe_allow_html=True)
# Subheading 2: What is a Video?
st.write("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #5b2c6f;">What is a Video?🎥✨</h3>
<p style="font-size: 16px; color: #333;">
A video is a collection of images, often referred to as frames, displayed one after another quickly
to show continuous movement. Each frame captures a moment in time, and when these frames are played
sequentially, they show continuous movement. Videos typically have a frame rate (e.g., 30 frames
per second or 60 frames per second), which determines how many frames are displayed per second.
Common video formats include MP4, AVI, and MOV.
</p>
</div>
""", unsafe_allow_html=True)
# Subheading 3: Why is an Image Called a Grid-Like Structure?
st.write("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #5b2c6f;">Why is an Image Called a Grid-Like Structure?🔲✨</h3>
<p style="font-size: 16px; color: #333;">
Images are called <strong>grid-like structures</strong> because they are composed of <strong>pixels</strong> arranged in rows and columns,
forming a rectangular grid. Each <strong>pixel</strong> contains information about <strong>shape</strong>, <strong>color</strong>, and <strong>patterns</strong>, which
together define the image's content.
The total number of <strong>pixels</strong> is determined by the image's height and width (resolution), and a higher resolution provides better clarity.
</p>
<p style="font-size: 16px; color: #333;">
In images, <strong>pixels</strong> act as features, and the entire grid represents a single data point. This combination
of features and data points gives images their grid-like nature.
</p>
<p style="font-size: 16px; color: #333;">
While images and tabular data are both grid-like, the difference lies in interpretation: in images, the
grid represents one data point, while in tabular data, rows represent data points, and columns represent features.
</p>
</div>
""", unsafe_allow_html=True)
# Visualization for Grid-Like Structure
height, width = 3,3
grid = np.random.rand(height, width)
# Adjust the figure size to make the plot very small
fig, ax = plt.subplots(figsize=(2,2)) # Even smaller figure size
cax = ax.imshow(grid, cmap='viridis', interpolation='nearest')
# Annotate the grid with pixel labels
for i in range(height):
for j in range(width):
ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', fontsize=4) # Smaller fontsize
# Set axis labels and title
ax.set_title("Image as a Grid-Like Structure", fontsize=5) # Smaller title size
ax.set_xlabel("Width (Pixels)", fontsize=4) # Smaller label size
ax.set_ylabel("Height (Pixels)", fontsize=4) # Smaller label size
ax.set_xticks(range(width))
ax.set_yticks(range(height))
ax.set_xticklabels([f'Col {j+1}' for j in range(width)], fontsize=4) # Smaller label size
ax.set_yticklabels([f'Row {i+1}' for i in range(height)], fontsize=4) # Smaller label size
ax.grid(color='white', linestyle='-', linewidth=0.5) # Thinner grid lines
# Color bar setup without fontsize argument
cbar = fig.colorbar(cax, ax=ax, orientation='vertical')
cbar.ax.tick_params(labelsize=4) # Adjust the font size of the color bar
# Display the plot
st.pyplot(fig)
st.write("""
<div style="text-align: left; margin-top: 20px;">
<h3 style="color: #5b2c6f;">What are color spaces?🎥✨</h3>
<p style="font-size: 16px; color: #333;">
</p>
</div>
""", unsafe_allow_html=True)
# Go Back Button
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_audio":
st.markdown("""
<h3 style="color: #e25822;">Exploring Audio</h3>
""", unsafe_allow_html=True)
st.write("""
Audio formats include MP3 and WAV for storing sound.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_text":
st.markdown("""
<h3 style="color: #e25822;">Exploring Text</h3>
""", unsafe_allow_html=True)
st.write("""
Text includes unstructured data like emails or plain-text files.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_csv":
st.markdown("""
<h3 style="color: #e25822;">Exploring CSV</h3>
""", unsafe_allow_html=True)
st.write("""
CSV is a simple text-based format where data fields are separated by commas.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_json":
st.markdown("""
<h3 style="color: #e25822;">Exploring JSON</h3>
""", unsafe_allow_html=True)
st.write("""
JSON is a semi-structured format used for APIs and data exchange.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_xml":
st.markdown("""
<h3 style="color: #e25822;">Exploring XML</h3>
""", unsafe_allow_html=True)
st.write("""
XML uses tags to structure semi-structured data.
""")
if st.button("Go Back"):
navigate_to("main")
elif st.session_state.current_page == "explore_html":
st.markdown("""
<h3 style="color: #e25822;">Exploring HTML</h3>
""", unsafe_allow_html=True)
st.write("""
HTML structures web pages using elements like <div> and <p>.
""")
if st.button("Go Back"):
navigate_to("main")
|