Phani1008 commited on
Commit
b10d4b1
Β·
verified Β·
1 Parent(s): 2a6dd60

Update pages/Types of Data.py

Browse files
Files changed (1) hide show
  1. 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
- # Load animations using URLs
20
- structured_animation_url = "https://assets10.lottiefiles.com/packages/lf20_4j6cnjjm.json"
21
- semi_structured_animation_url = "https://assets10.lottiefiles.com/packages/lf20_0fhcmhgf.json"
22
- unstructured_animation_url = "https://assets10.lottiefiles.com/packages/lf20_rekwjvy0.json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- # Sidebar navigation
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
- if page == "Home":
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
- elif page == "Structured Data":
37
- st.title("Structured Data πŸ“‹")
38
- animation = load_lottie_url(structured_animation_url)
39
- if animation:
40
- st_lottie(animation, height=300, key="structured_animation")
41
- st.write("""
42
- **Definition**: Structured data refers to data organized in predefined formats like tables, making it easily searchable.
43
- """)
44
 
45
- elif page == "Semi-Structured Data":
46
- st.title("Semi-Structured Data 🧩")
47
- animation = load_lottie_url(semi_structured_animation_url)
48
- if animation:
49
- st_lottie(animation, height=300, key="semi_structured_animation")
50
- st.write("""
51
- **Definition**: Semi-structured data lacks a strict schema but is organized through tags and markers.
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
- # Image Augmentation Section
64
- elif page == "Image Augmentation":
65
- st.title("Image Augmentation Tool πŸ–ΌοΈ")
 
 
 
66
 
67
- def augment_image(image, crop_size, flip, rotation):
68
- img = Image.fromarray(image)
69
- if crop_size > 0:
70
- width, height = img.size
71
- left = random.randint(0, crop_size)
72
- top = random.randint(0, crop_size)
73
- right = width - random.randint(0, crop_size)
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
- def interface(image, crop_size, flip, rotation):
83
- augmented_image = augment_image(image, crop_size, flip, rotation)
84
- return augmented_image
 
 
 
85
 
86
- app = gr.Interface(
87
- fn=interface,
88
- inputs=[
89
- gr.Image(type="numpy"),
90
- gr.Slider(0, 100, step=1, label="Crop Size"),
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
- app.launch()
 
 
 
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!")