Spaces:
Sleeping
Sleeping
Update pages/Types of Data.py
Browse files- pages/Types of Data.py +74 -87
pages/Types of Data.py
CHANGED
|
@@ -1,99 +1,86 @@
|
|
| 1 |
-
pip install transformers
|
| 2 |
-
|
| 3 |
import streamlit as st
|
| 4 |
-
from streamlit_lottie import st_lottie
|
| 5 |
-
import requests
|
| 6 |
-
from transformers import pipeline
|
| 7 |
-
import gradio as gr
|
| 8 |
-
from PIL import Image, ImageOps
|
| 9 |
-
import numpy as np
|
| 10 |
-
import random
|
| 11 |
-
|
| 12 |
-
# Function to load Lottie animation from a URL
|
| 13 |
-
def load_lottie_url(url: str):
|
| 14 |
-
r = requests.get(url)
|
| 15 |
-
if r.status_code != 200:
|
| 16 |
-
return None
|
| 17 |
-
return r.json()
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
|
| 25 |
-
st.sidebar.title("Navigation")
|
| 26 |
-
page = st.sidebar.radio("Choose a page", ["Home", "Structured Data", "Semi-Structured Data", "Unstructured Data", "Image Augmentation"])
|
| 27 |
|
| 28 |
-
|
| 29 |
-
st.title("Understanding Data and Its Types π")
|
| 30 |
-
st.header("What is Data?")
|
| 31 |
-
st.write("""
|
| 32 |
-
**Data** refers to raw facts, figures, or information that can be collected, measured, and analyzed for specific purposes.
|
| 33 |
-
It serves as the foundation for generating insights, making decisions, and solving problems in various fields.
|
| 34 |
-
""")
|
| 35 |
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
st.write("""
|
| 42 |
-
**Definition**: Structured data refers to data organized in predefined formats like tables, making it easily searchable.
|
| 43 |
-
""")
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
""")
|
| 53 |
-
|
| 54 |
-
elif page == "Unstructured Data":
|
| 55 |
-
st.title("Unstructured Data ποΈ")
|
| 56 |
-
animation = load_lottie_url(unstructured_animation_url)
|
| 57 |
-
if animation:
|
| 58 |
-
st_lottie(animation, height=300, key="unstructured_animation")
|
| 59 |
-
st.write("""
|
| 60 |
-
**Definition**: Unstructured data lacks predefined organization, including images, videos, and audio files.
|
| 61 |
-
""")
|
| 62 |
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
st.
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
bottom = height - random.randint(0, crop_size)
|
| 75 |
-
img = img.crop((left, top, right, bottom))
|
| 76 |
-
if flip:
|
| 77 |
-
img = ImageOps.mirror(img)
|
| 78 |
-
if rotation != 0:
|
| 79 |
-
img = img.rotate(rotation, expand=True)
|
| 80 |
-
return np.array(img)
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
gr.Checkbox(label="Flip"),
|
| 92 |
-
gr.Slider(0, 360, step=1, label="Rotation Angle")
|
| 93 |
-
],
|
| 94 |
-
outputs=gr.Image(type="numpy"),
|
| 95 |
-
title="Image Augmentation Tool",
|
| 96 |
-
description="Upload an image to apply cropping, flipping, and rotation."
|
| 97 |
)
|
| 98 |
|
| 99 |
-
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
# Custom CSS for enhanced styling with gradients and interactive hover effects
|
| 4 |
+
st.markdown(
|
| 5 |
+
"""
|
| 6 |
+
<style>
|
| 7 |
+
.stApp {
|
| 8 |
+
background: linear-gradient(135deg, #1f1c2c, #928dab);
|
| 9 |
+
color: #E0E0E0;
|
| 10 |
+
}
|
| 11 |
+
.stTitle {
|
| 12 |
+
text-align: center;
|
| 13 |
+
color: #76FF03;
|
| 14 |
+
}
|
| 15 |
+
.css-1d391kg p, .css-1v0mbdj p {
|
| 16 |
+
color: #B0BEC5;
|
| 17 |
+
}
|
| 18 |
+
.css-1aumxhk .stSlider .st-dh{
|
| 19 |
+
background-color: #76FF03;
|
| 20 |
+
}
|
| 21 |
+
.stButton > button:hover {
|
| 22 |
+
background-color: #4CAF50;
|
| 23 |
+
color: white;
|
| 24 |
+
transform: scale(1.05);
|
| 25 |
+
}
|
| 26 |
+
.download-button button {
|
| 27 |
+
background-color: #FF4081;
|
| 28 |
+
color: white;
|
| 29 |
+
}
|
| 30 |
+
.download-button button:hover {
|
| 31 |
+
background-color: #F50057;
|
| 32 |
+
transform: scale(1.1);
|
| 33 |
+
}
|
| 34 |
+
</style>
|
| 35 |
+
""",
|
| 36 |
+
unsafe_allow_html=True,
|
| 37 |
+
)
|
| 38 |
|
| 39 |
+
st.title("π Data Types Explorer", anchor=False)
|
|
|
|
|
|
|
| 40 |
|
| 41 |
+
st.sidebar.subheader("π Explore Data Types")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
# Dropdown to select data type to learn about
|
| 44 |
+
data_type = st.sidebar.selectbox(
|
| 45 |
+
"Select a Type of Data:",
|
| 46 |
+
["Structured Data", "Unstructured Data", "Semi-Structured Data", "Time-Series Data", "Spatial Data"]
|
| 47 |
+
)
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
+
# Display information based on selected data type
|
| 50 |
+
if data_type == "Structured Data":
|
| 51 |
+
st.subheader("π Structured Data")
|
| 52 |
+
st.write(
|
| 53 |
+
"Structured data is organized and stored in databases with clear formats, such as rows and columns."
|
| 54 |
+
" Examples include Excel files, SQL databases, and CSV files."
|
| 55 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
+
elif data_type == "Unstructured Data":
|
| 58 |
+
st.subheader("ποΈ Unstructured Data")
|
| 59 |
+
st.write(
|
| 60 |
+
"Unstructured data lacks a predefined format and cannot be stored easily in relational databases."
|
| 61 |
+
" Examples include images, videos, and social media posts."
|
| 62 |
+
)
|
| 63 |
|
| 64 |
+
elif data_type == "Semi-Structured Data":
|
| 65 |
+
st.subheader("π Semi-Structured Data")
|
| 66 |
+
st.write(
|
| 67 |
+
"Semi-structured data falls between structured and unstructured data."
|
| 68 |
+
" It contains tags and markers to separate data but does not fit into traditional databases."
|
| 69 |
+
" Examples include JSON, XML, and YAML files."
|
| 70 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
+
elif data_type == "Time-Series Data":
|
| 73 |
+
st.subheader("β±οΈ Time-Series Data")
|
| 74 |
+
st.write(
|
| 75 |
+
"Time-series data represents information recorded at specific time intervals."
|
| 76 |
+
" Examples include stock prices, weather data, and sensor readings."
|
| 77 |
+
)
|
| 78 |
|
| 79 |
+
elif data_type == "Spatial Data":
|
| 80 |
+
st.subheader("πΊοΈ Spatial Data")
|
| 81 |
+
st.write(
|
| 82 |
+
"Spatial data represents the location and shape of objects in space."
|
| 83 |
+
" Examples include GPS data, maps, and satellite imagery."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
)
|
| 85 |
|
| 86 |
+
st.sidebar.success("Select a data type to learn more!")
|