Spaces:
Sleeping
Sleeping
Update pages/Data Collection.py
Browse files- pages/Data Collection.py +134 -74
pages/Data Collection.py
CHANGED
|
@@ -55,13 +55,17 @@ def navigate_to(page_name):
|
|
| 55 |
|
| 56 |
# Main Page
|
| 57 |
if st.session_state.current_page == "main":
|
|
|
|
|
|
|
|
|
|
| 58 |
# Page Title
|
| 59 |
st.markdown("""
|
| 60 |
<div style="text-align: left; margin-top: 20px;">
|
| 61 |
-
<h2 style="color: #BB3385;">What is Data
|
| 62 |
</div>
|
| 63 |
""", unsafe_allow_html=True)
|
| 64 |
|
|
|
|
| 65 |
# Introduction Text
|
| 66 |
st.write("""
|
| 67 |
**Data** is the measurements that are collected as a source of Information.
|
|
@@ -75,29 +79,32 @@ if st.session_state.current_page == "main":
|
|
| 75 |
</div>
|
| 76 |
""", unsafe_allow_html=True)
|
| 77 |
|
| 78 |
-
|
| 79 |
data_type = st.radio(
|
| 80 |
"Select the type of Data:",
|
| 81 |
("Structured Data", "Unstructured Data", "Semi-Structured Data")
|
| 82 |
)
|
| 83 |
-
|
| 84 |
if data_type == "Structured Data":
|
| 85 |
st.markdown("""
|
| 86 |
<div style="text-align: left; margin-top: 20px;">
|
| 87 |
<h3 style="color: #e25822;">What is Structured Data?</h3>
|
| 88 |
</div>
|
| 89 |
""", unsafe_allow_html=True)
|
| 90 |
-
|
| 91 |
st.markdown("""
|
| 92 |
<div style="text-align: left; margin-top: 20px;">
|
| 93 |
<h4 style="color: #5b2c6f;">Definition:</h4>
|
| 94 |
</div>
|
| 95 |
""", unsafe_allow_html=True)
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
| 99 |
""")
|
| 100 |
|
|
|
|
| 101 |
st.markdown("""
|
| 102 |
<div style="text-align: left; margin-top: 20px;">
|
| 103 |
<h4 style="color: #5b2c6f;">Characteristics:</h4>
|
|
@@ -139,9 +146,13 @@ if st.session_state.current_page == "main":
|
|
| 139 |
st.write("Click to explore Structured Data Formats:")
|
| 140 |
col1, col2 = st.columns(2) # Define two columns using Streamlit's columns method
|
| 141 |
|
|
|
|
|
|
|
| 142 |
with col1:
|
| 143 |
if st.button("📊 Explore Excel"):
|
| 144 |
navigate_to("explore_excel")
|
|
|
|
|
|
|
| 145 |
|
| 146 |
|
| 147 |
|
|
@@ -198,14 +209,18 @@ if st.session_state.current_page == "main":
|
|
| 198 |
with col1:
|
| 199 |
if st.button("📸 Images & Videos"):
|
| 200 |
navigate_to("explore_images_video")
|
|
|
|
| 201 |
|
| 202 |
with col2:
|
| 203 |
if st.button("🎵 Audio"):
|
| 204 |
navigate_to("explore_audio")
|
|
|
|
| 205 |
|
| 206 |
with col3:
|
| 207 |
if st.button("✍️ Text"):
|
| 208 |
navigate_to("explore_text")
|
|
|
|
|
|
|
| 209 |
|
| 210 |
elif data_type == "Semi-Structured Data":
|
| 211 |
st.markdown("""
|
|
@@ -256,23 +271,28 @@ if st.session_state.current_page == "main":
|
|
| 256 |
""", unsafe_allow_html=True)
|
| 257 |
|
| 258 |
st.write("Click to explore Semi-Structured Data Formats:")
|
|
|
|
| 259 |
col1, col2, col3, col4 = st.columns(4)
|
| 260 |
|
| 261 |
with col1:
|
| 262 |
if st.button("📄 CSV"):
|
| 263 |
navigate_to("explore_csv")
|
|
|
|
| 264 |
|
| 265 |
with col2:
|
| 266 |
if st.button("📋 JSON"):
|
| 267 |
navigate_to("explore_json")
|
|
|
|
| 268 |
|
| 269 |
with col3:
|
| 270 |
if st.button("📜 XML"):
|
| 271 |
navigate_to("explore_xml")
|
|
|
|
| 272 |
|
| 273 |
with col4:
|
| 274 |
if st.button("🌐 HTML"):
|
| 275 |
navigate_to("explore_html")
|
|
|
|
| 276 |
|
| 277 |
|
| 278 |
|
|
@@ -476,7 +496,7 @@ if st.session_state.current_page == "explore_excel":
|
|
| 476 |
|
| 477 |
with col1:
|
| 478 |
st.markdown("""
|
| 479 |
-
<a href="https://colab.research.google.com/drive/1qSWM2h-_ND9Nv7GVW9q5onpdcrlFauHc?usp=sharing" target="_blank">
|
| 480 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 481 |
Open Google Colab File
|
| 482 |
</button>
|
|
@@ -485,7 +505,9 @@ if st.session_state.current_page == "explore_excel":
|
|
| 485 |
|
| 486 |
with col2:
|
| 487 |
if st.button("⬅️ Back to Previous Page"):
|
| 488 |
-
st.session_state.current_page = "main"
|
|
|
|
|
|
|
| 489 |
|
| 490 |
|
| 491 |
#--------------------------------------------------------- Images and Video --------------------------------------------------------------------------------
|
|
@@ -721,10 +743,12 @@ elif st.session_state.current_page == "explore_images_video":
|
|
| 721 |
with col1:
|
| 722 |
if st.button("⬅️ Back to Previous Page"):
|
| 723 |
navigate_to("main")
|
|
|
|
| 724 |
|
| 725 |
with col2:
|
| 726 |
if st.button("➡️ Image Operations with OpenCV"):
|
| 727 |
navigate_to("opencv_operations")
|
|
|
|
| 728 |
|
| 729 |
|
| 730 |
elif st.session_state.current_page == "opencv_operations":
|
|
@@ -904,7 +928,7 @@ elif st.session_state.current_page == "opencv_operations":
|
|
| 904 |
|
| 905 |
with col1:
|
| 906 |
st.markdown("""
|
| 907 |
-
<a href="https://colab.research.google.com/drive/1P9nT1HmOcCah5nTctxCm7hVdqqYPUkzn?usp=sharing" target="_blank">
|
| 908 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 909 |
Colab Notes
|
| 910 |
</button>
|
|
@@ -913,18 +937,22 @@ elif st.session_state.current_page == "opencv_operations":
|
|
| 913 |
|
| 914 |
with col2:
|
| 915 |
if st.button("Unstructured Data"):
|
| 916 |
-
navigate_to("main")
|
|
|
|
| 917 |
|
| 918 |
-
# Second row: Previous Page and
|
| 919 |
col3, col4 = st.columns(2)
|
| 920 |
|
| 921 |
with col3:
|
| 922 |
-
if st.button("⬅️
|
| 923 |
-
navigate_to("explore_images_video")
|
|
|
|
| 924 |
|
| 925 |
with col4:
|
| 926 |
-
if st.button("➡️
|
| 927 |
-
navigate_to("image_operations")
|
|
|
|
|
|
|
| 928 |
|
| 929 |
|
| 930 |
elif st.session_state.current_page == "image_operations":
|
|
@@ -1095,43 +1123,50 @@ elif st.session_state.current_page == "image_operations":
|
|
| 1095 |
|
| 1096 |
st.write("Once you upload an image, it will be split into its color channels (Blue, Green, and Red), with each channel displayed separately. You can then download the processed image.")
|
| 1097 |
|
| 1098 |
-
|
| 1099 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
| 1100 |
|
| 1101 |
if uploaded_file is not None:
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
|
| 1106 |
-
|
| 1107 |
-
|
| 1108 |
|
| 1109 |
-
|
| 1110 |
-
|
|
|
|
|
|
|
| 1111 |
|
| 1112 |
-
|
| 1113 |
-
|
| 1114 |
-
|
| 1115 |
-
|
| 1116 |
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
st.image(green_channel, caption="Green Channel", channels="BGR", use_container_width=True)
|
| 1120 |
-
st.image(red_channel, caption="Red Channel", channels="BGR", use_container_width=True)
|
| 1121 |
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
|
| 1125 |
-
|
| 1126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1127 |
|
| 1128 |
-
# Optionally, provide a download link for the processed image
|
| 1129 |
-
st.download_button(
|
| 1130 |
-
label="Download Merged Image",
|
| 1131 |
-
data=cv2.imencode('.jpg', original_img)[1].tobytes(),
|
| 1132 |
-
file_name="merged_image.jpg",
|
| 1133 |
-
mime="image/jpeg"
|
| 1134 |
-
)
|
| 1135 |
else:
|
| 1136 |
st.write("Please upload an image to proceed.")
|
| 1137 |
|
|
@@ -1165,12 +1200,12 @@ elif st.session_state.current_page == "image_operations":
|
|
| 1165 |
Stay tuned for an exciting exploration of video handling!
|
| 1166 |
""")
|
| 1167 |
|
|
|
|
| 1168 |
col1, col2 = st.columns(2)
|
| 1169 |
|
| 1170 |
-
# First row: Colab Notes and Main Page
|
| 1171 |
with col1:
|
| 1172 |
st.markdown("""
|
| 1173 |
-
<a href="https://colab.research.google.com/drive/
|
| 1174 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 1175 |
Colab Notes
|
| 1176 |
</button>
|
|
@@ -1179,18 +1214,22 @@ elif st.session_state.current_page == "image_operations":
|
|
| 1179 |
|
| 1180 |
with col2:
|
| 1181 |
if st.button("Unstructured Data"):
|
| 1182 |
-
navigate_to("main")
|
|
|
|
| 1183 |
|
| 1184 |
-
# Second row:
|
| 1185 |
col3, col4 = st.columns(2)
|
| 1186 |
|
| 1187 |
with col3:
|
| 1188 |
-
if st.button("⬅️
|
| 1189 |
-
navigate_to("opencv_operations") #
|
|
|
|
| 1190 |
|
| 1191 |
with col4:
|
| 1192 |
-
if st.button("➡️
|
| 1193 |
-
navigate_to("video_processing") #
|
|
|
|
|
|
|
| 1194 |
|
| 1195 |
|
| 1196 |
|
|
@@ -1489,9 +1528,9 @@ elif st.session_state.current_page == "video_processing":
|
|
| 1489 |
Get ready to learn about powerful image transformation techniques!
|
| 1490 |
""")
|
| 1491 |
|
| 1492 |
-
col1, col2 = st.columns(2)
|
| 1493 |
-
|
| 1494 |
# First row: Colab Notes and Main Page
|
|
|
|
|
|
|
| 1495 |
with col1:
|
| 1496 |
st.markdown("""
|
| 1497 |
<a href="https://colab.research.google.com/drive/1zzovaAr4NNJoJSR-lA9ApSyPguLKf3UB?usp=sharing" target="_blank">
|
|
@@ -1500,21 +1539,24 @@ elif st.session_state.current_page == "video_processing":
|
|
| 1500 |
</button>
|
| 1501 |
</a>
|
| 1502 |
""", unsafe_allow_html=True)
|
| 1503 |
-
|
| 1504 |
with col2:
|
| 1505 |
if st.button("Unstructured Data"):
|
| 1506 |
navigate_to("main") # Main page: Images & Videos
|
| 1507 |
-
|
| 1508 |
-
|
|
|
|
| 1509 |
col3, col4 = st.columns(2)
|
| 1510 |
-
|
| 1511 |
with col3:
|
| 1512 |
-
if st.button("⬅️
|
| 1513 |
navigate_to("image_operations") # Previous page: Explore Image Creation and Manipulation
|
| 1514 |
-
|
|
|
|
| 1515 |
with col4:
|
| 1516 |
-
if st.button("➡️
|
| 1517 |
-
navigate_to("
|
|
|
|
| 1518 |
|
| 1519 |
|
| 1520 |
elif st.session_state.current_page == "image_transformations":
|
|
@@ -1931,25 +1973,33 @@ elif st.session_state.current_page == "image_transformations":
|
|
| 1931 |
st.warning("Please select a valid transformation type to proceed.")
|
| 1932 |
|
| 1933 |
col1, col2 = st.columns(2)
|
|
|
|
|
|
|
| 1934 |
with col1:
|
| 1935 |
st.markdown("""
|
| 1936 |
-
<a href="https://colab.research.google.com/drive/19mQM-7VY0F0y9NyecrhbU5kyOY9j9oIk?usp=sharing" target="_blank">
|
| 1937 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 1938 |
Colab Notes
|
| 1939 |
</button>
|
| 1940 |
</a>
|
| 1941 |
""", unsafe_allow_html=True)
|
|
|
|
| 1942 |
with col2:
|
| 1943 |
-
if st.button("Unstructured Data"):
|
| 1944 |
st.session_state.current_page = "main"
|
| 1945 |
-
|
|
|
|
|
|
|
| 1946 |
col3, col4 = st.columns(2)
|
| 1947 |
with col3:
|
| 1948 |
-
if st.button("⬅️
|
| 1949 |
st.session_state.current_page = "video_processing"
|
|
|
|
| 1950 |
with col4:
|
| 1951 |
-
if st.button("➡️
|
| 1952 |
st.session_state.current_page = "opencv_projects"
|
|
|
|
|
|
|
| 1953 |
|
| 1954 |
|
| 1955 |
elif st.session_state.current_page == "opencv_projects":
|
|
@@ -2043,13 +2093,16 @@ elif st.session_state.current_page == "opencv_projects":
|
|
| 2043 |
|
| 2044 |
# Column 1 - Button to go back to the Image Transformations page
|
| 2045 |
with col1:
|
| 2046 |
-
if st.button("⬅️ Image Transformations with OpenCV"):
|
| 2047 |
navigate_to("image_transformations")
|
|
|
|
| 2048 |
|
| 2049 |
# Column 2 - Button for the main page (Images & Videos)
|
| 2050 |
with col2:
|
| 2051 |
-
if st.button("Unstructured Data"):
|
| 2052 |
-
navigate_to("main")
|
|
|
|
|
|
|
| 2053 |
|
| 2054 |
|
| 2055 |
|
|
@@ -2246,7 +2299,9 @@ elif st.session_state.current_page == "explore_csv":
|
|
| 2246 |
|
| 2247 |
with col2:
|
| 2248 |
if st.button("⬅️ Back to Previous Page"):
|
| 2249 |
-
st.session_state.current_page = "main"
|
|
|
|
|
|
|
| 2250 |
|
| 2251 |
|
| 2252 |
#--------------------------------------------------------- Json --------------------------------------------------------------------------------
|
|
@@ -2580,7 +2635,9 @@ elif st.session_state.current_page == "explore_json":
|
|
| 2580 |
|
| 2581 |
with col2:
|
| 2582 |
if st.button("⬅️ Back to Previous Page"):
|
| 2583 |
-
st.session_state.current_page = "main"
|
|
|
|
|
|
|
| 2584 |
|
| 2585 |
|
| 2586 |
#--------------------------------------------------------- XML -------------------------------------------------------------------------------
|
|
@@ -2732,7 +2789,9 @@ elif st.session_state.current_page == "explore_xml":
|
|
| 2732 |
|
| 2733 |
with col2:
|
| 2734 |
if st.button("⬅️ Back to Previous Page"):
|
| 2735 |
-
st.session_state.current_page = "main"
|
|
|
|
|
|
|
| 2736 |
|
| 2737 |
#--------------------------------------------------------- HTML --------------------------------------------------------------------------------
|
| 2738 |
|
|
@@ -2800,7 +2859,6 @@ elif st.session_state.current_page == "explore_html":
|
|
| 2800 |
data.to_html('output.html', index=False)
|
| 2801 |
""", language="python")
|
| 2802 |
|
| 2803 |
-
|
| 2804 |
col1, col2 = st.columns(2)
|
| 2805 |
|
| 2806 |
with col1:
|
|
@@ -2814,4 +2872,6 @@ elif st.session_state.current_page == "explore_html":
|
|
| 2814 |
|
| 2815 |
with col2:
|
| 2816 |
if st.button("⬅️ Back to Previous Page"):
|
| 2817 |
-
st.session_state.current_page = "main"
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Main Page
|
| 57 |
if st.session_state.current_page == "main":
|
| 58 |
+
# Reset scroll to top
|
| 59 |
+
st.query_params.update({})
|
| 60 |
+
|
| 61 |
# Page Title
|
| 62 |
st.markdown("""
|
| 63 |
<div style="text-align: left; margin-top: 20px;">
|
| 64 |
+
<h2 style="color: #BB3385;">What is Data? 📊✨</h2>
|
| 65 |
</div>
|
| 66 |
""", unsafe_allow_html=True)
|
| 67 |
|
| 68 |
+
|
| 69 |
# Introduction Text
|
| 70 |
st.write("""
|
| 71 |
**Data** is the measurements that are collected as a source of Information.
|
|
|
|
| 79 |
</div>
|
| 80 |
""", unsafe_allow_html=True)
|
| 81 |
|
| 82 |
+
# Radio Button for Data Type Selection
|
| 83 |
data_type = st.radio(
|
| 84 |
"Select the type of Data:",
|
| 85 |
("Structured Data", "Unstructured Data", "Semi-Structured Data")
|
| 86 |
)
|
| 87 |
+
|
| 88 |
if data_type == "Structured Data":
|
| 89 |
st.markdown("""
|
| 90 |
<div style="text-align: left; margin-top: 20px;">
|
| 91 |
<h3 style="color: #e25822;">What is Structured Data?</h3>
|
| 92 |
</div>
|
| 93 |
""", unsafe_allow_html=True)
|
| 94 |
+
|
| 95 |
st.markdown("""
|
| 96 |
<div style="text-align: left; margin-top: 20px;">
|
| 97 |
<h4 style="color: #5b2c6f;">Definition:</h4>
|
| 98 |
</div>
|
| 99 |
""", unsafe_allow_html=True)
|
| 100 |
+
|
| 101 |
+
st.markdown("""
|
| 102 |
+
**Structured data** refers to information that is organized and formatted in a predefined manner,
|
| 103 |
+
making it easy to store, retrieve, and analyze.
|
| 104 |
+
It is typically stored in tabular formats like rows and columns, where each field contains a specific type of information.
|
| 105 |
""")
|
| 106 |
|
| 107 |
+
|
| 108 |
st.markdown("""
|
| 109 |
<div style="text-align: left; margin-top: 20px;">
|
| 110 |
<h4 style="color: #5b2c6f;">Characteristics:</h4>
|
|
|
|
| 146 |
st.write("Click to explore Structured Data Formats:")
|
| 147 |
col1, col2 = st.columns(2) # Define two columns using Streamlit's columns method
|
| 148 |
|
| 149 |
+
col1, col2 = st.columns(2)
|
| 150 |
+
|
| 151 |
with col1:
|
| 152 |
if st.button("📊 Explore Excel"):
|
| 153 |
navigate_to("explore_excel")
|
| 154 |
+
st.query_params.update({}) # Ensure page starts from the top after navigation
|
| 155 |
+
|
| 156 |
|
| 157 |
|
| 158 |
|
|
|
|
| 209 |
with col1:
|
| 210 |
if st.button("📸 Images & Videos"):
|
| 211 |
navigate_to("explore_images_video")
|
| 212 |
+
st.query_params.update({})
|
| 213 |
|
| 214 |
with col2:
|
| 215 |
if st.button("🎵 Audio"):
|
| 216 |
navigate_to("explore_audio")
|
| 217 |
+
st.query_params.update({})
|
| 218 |
|
| 219 |
with col3:
|
| 220 |
if st.button("✍️ Text"):
|
| 221 |
navigate_to("explore_text")
|
| 222 |
+
st.query_params.update({})
|
| 223 |
+
|
| 224 |
|
| 225 |
elif data_type == "Semi-Structured Data":
|
| 226 |
st.markdown("""
|
|
|
|
| 271 |
""", unsafe_allow_html=True)
|
| 272 |
|
| 273 |
st.write("Click to explore Semi-Structured Data Formats:")
|
| 274 |
+
|
| 275 |
col1, col2, col3, col4 = st.columns(4)
|
| 276 |
|
| 277 |
with col1:
|
| 278 |
if st.button("📄 CSV"):
|
| 279 |
navigate_to("explore_csv")
|
| 280 |
+
st.query_params.update({})
|
| 281 |
|
| 282 |
with col2:
|
| 283 |
if st.button("📋 JSON"):
|
| 284 |
navigate_to("explore_json")
|
| 285 |
+
st.query_params.update({})
|
| 286 |
|
| 287 |
with col3:
|
| 288 |
if st.button("📜 XML"):
|
| 289 |
navigate_to("explore_xml")
|
| 290 |
+
st.query_params.update({})
|
| 291 |
|
| 292 |
with col4:
|
| 293 |
if st.button("🌐 HTML"):
|
| 294 |
navigate_to("explore_html")
|
| 295 |
+
st.query_params.update({})
|
| 296 |
|
| 297 |
|
| 298 |
|
|
|
|
| 496 |
|
| 497 |
with col1:
|
| 498 |
st.markdown("""
|
| 499 |
+
<a href="https://colab.research.google.com/drive/1qSWM2h-_ND9Nv7GVW9q5onpdcrlFauHc?usp=sharing" target="_blank" title="Open the associated Google Colab file">
|
| 500 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 501 |
Open Google Colab File
|
| 502 |
</button>
|
|
|
|
| 505 |
|
| 506 |
with col2:
|
| 507 |
if st.button("⬅️ Back to Previous Page"):
|
| 508 |
+
st.session_state.current_page = "main"
|
| 509 |
+
st.query_params.update({})
|
| 510 |
+
|
| 511 |
|
| 512 |
|
| 513 |
#--------------------------------------------------------- Images and Video --------------------------------------------------------------------------------
|
|
|
|
| 743 |
with col1:
|
| 744 |
if st.button("⬅️ Back to Previous Page"):
|
| 745 |
navigate_to("main")
|
| 746 |
+
st.query_params.update({})
|
| 747 |
|
| 748 |
with col2:
|
| 749 |
if st.button("➡️ Image Operations with OpenCV"):
|
| 750 |
navigate_to("opencv_operations")
|
| 751 |
+
st.query_params.update({})
|
| 752 |
|
| 753 |
|
| 754 |
elif st.session_state.current_page == "opencv_operations":
|
|
|
|
| 928 |
|
| 929 |
with col1:
|
| 930 |
st.markdown("""
|
| 931 |
+
<a href="https://colab.research.google.com/drive/1P9nT1HmOcCah5nTctxCm7hVdqqYPUkzn?usp=sharing" target="_blank" title="Open Colab Notes">
|
| 932 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 933 |
Colab Notes
|
| 934 |
</button>
|
|
|
|
| 937 |
|
| 938 |
with col2:
|
| 939 |
if st.button("Unstructured Data"):
|
| 940 |
+
navigate_to("main")
|
| 941 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 942 |
|
| 943 |
+
# Second row: Previous Page and Explore Operations
|
| 944 |
col3, col4 = st.columns(2)
|
| 945 |
|
| 946 |
with col3:
|
| 947 |
+
if st.button("⬅️ Overview Page"):
|
| 948 |
+
navigate_to("explore_images_video")
|
| 949 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 950 |
|
| 951 |
with col4:
|
| 952 |
+
if st.button("➡️ Explore Operations"):
|
| 953 |
+
navigate_to("image_operations")
|
| 954 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 955 |
+
|
| 956 |
|
| 957 |
|
| 958 |
elif st.session_state.current_page == "image_operations":
|
|
|
|
| 1123 |
|
| 1124 |
st.write("Once you upload an image, it will be split into its color channels (Blue, Green, and Red), with each channel displayed separately. You can then download the processed image.")
|
| 1125 |
|
| 1126 |
+
# Allow user to upload an image
|
| 1127 |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "png", "jpeg"])
|
| 1128 |
|
| 1129 |
if uploaded_file is not None:
|
| 1130 |
+
try:
|
| 1131 |
+
# Convert the uploaded image to an OpenCV-compatible format
|
| 1132 |
+
image = np.array(bytearray(uploaded_file.read()), dtype=np.uint8)
|
| 1133 |
+
img = cv2.imdecode(image, 1) # Decode into an image
|
| 1134 |
+
|
| 1135 |
+
if img is None:
|
| 1136 |
+
st.error("Uploaded file is not a valid image. Please upload a valid JPG or PNG file.")
|
| 1137 |
+
else:
|
| 1138 |
+
# Split the image into Blue, Green, and Red channels
|
| 1139 |
+
b, g, r = cv2.split(img)
|
| 1140 |
|
| 1141 |
+
# Create a zeros array to hold the empty channels
|
| 1142 |
+
zeros = np.zeros(img.shape[:-1], dtype=np.uint8)
|
| 1143 |
|
| 1144 |
+
# Merge the Blue channel with zeros for Green and Red
|
| 1145 |
+
blue_channel = cv2.merge([b, zeros, zeros])
|
| 1146 |
+
green_channel = cv2.merge([zeros, g, zeros])
|
| 1147 |
+
red_channel = cv2.merge([zeros, zeros, r])
|
| 1148 |
|
| 1149 |
+
# Display the images with captions
|
| 1150 |
+
st.image(blue_channel, caption="Blue Channel", channels="BGR", use_container_width=True)
|
| 1151 |
+
st.image(green_channel, caption="Green Channel", channels="BGR", use_container_width=True)
|
| 1152 |
+
st.image(red_channel, caption="Red Channel", channels="BGR", use_container_width=True)
|
| 1153 |
|
| 1154 |
+
# Merge the channels back together for the original image
|
| 1155 |
+
original_img = cv2.merge([b, g, r])
|
|
|
|
|
|
|
| 1156 |
|
| 1157 |
+
# Display the original image
|
| 1158 |
+
st.image(original_img, caption="Original Image", channels="BGR", use_container_width=True)
|
| 1159 |
|
| 1160 |
+
# Provide a download link for the processed image
|
| 1161 |
+
st.download_button(
|
| 1162 |
+
label="Download Merged Image",
|
| 1163 |
+
data=cv2.imencode('.jpg', original_img)[1].tobytes(),
|
| 1164 |
+
file_name="merged_image.jpg",
|
| 1165 |
+
mime="image/jpeg"
|
| 1166 |
+
)
|
| 1167 |
+
except Exception as e:
|
| 1168 |
+
st.error(f"An error occurred: {e}")
|
| 1169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1170 |
else:
|
| 1171 |
st.write("Please upload an image to proceed.")
|
| 1172 |
|
|
|
|
| 1200 |
Stay tuned for an exciting exploration of video handling!
|
| 1201 |
""")
|
| 1202 |
|
| 1203 |
+
# First row: Colab Notes and Main Page
|
| 1204 |
col1, col2 = st.columns(2)
|
| 1205 |
|
|
|
|
| 1206 |
with col1:
|
| 1207 |
st.markdown("""
|
| 1208 |
+
<a href="https://colab.research.google.com/drive/YOUR_COLAB_NOTEBOOK_LINK" target="_blank" title="Open Colab Notes">
|
| 1209 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 1210 |
Colab Notes
|
| 1211 |
</button>
|
|
|
|
| 1214 |
|
| 1215 |
with col2:
|
| 1216 |
if st.button("Unstructured Data"):
|
| 1217 |
+
navigate_to("main")
|
| 1218 |
+
st.query_params.update({}) # Reset scroll position
|
| 1219 |
|
| 1220 |
+
# Second row: Custom Navigation Buttons
|
| 1221 |
col3, col4 = st.columns(2)
|
| 1222 |
|
| 1223 |
with col3:
|
| 1224 |
+
if st.button("⬅️Back to Image Operations"):
|
| 1225 |
+
navigate_to("opencv_operations") # Replace with the actual previous page identifier
|
| 1226 |
+
st.query_params.update({}) # Reset scroll position
|
| 1227 |
|
| 1228 |
with col4:
|
| 1229 |
+
if st.button("➡️Explore Video Processing"):
|
| 1230 |
+
navigate_to("video_processing") # Replace with the actual next page identifier
|
| 1231 |
+
st.query_params.update({}) # Reset scroll position
|
| 1232 |
+
|
| 1233 |
|
| 1234 |
|
| 1235 |
|
|
|
|
| 1528 |
Get ready to learn about powerful image transformation techniques!
|
| 1529 |
""")
|
| 1530 |
|
|
|
|
|
|
|
| 1531 |
# First row: Colab Notes and Main Page
|
| 1532 |
+
col1, col2 = st.columns(2)
|
| 1533 |
+
|
| 1534 |
with col1:
|
| 1535 |
st.markdown("""
|
| 1536 |
<a href="https://colab.research.google.com/drive/1zzovaAr4NNJoJSR-lA9ApSyPguLKf3UB?usp=sharing" target="_blank">
|
|
|
|
| 1539 |
</button>
|
| 1540 |
</a>
|
| 1541 |
""", unsafe_allow_html=True)
|
| 1542 |
+
|
| 1543 |
with col2:
|
| 1544 |
if st.button("Unstructured Data"):
|
| 1545 |
navigate_to("main") # Main page: Images & Videos
|
| 1546 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 1547 |
+
|
| 1548 |
+
# Second row: Previous Page and Video Transformations
|
| 1549 |
col3, col4 = st.columns(2)
|
| 1550 |
+
|
| 1551 |
with col3:
|
| 1552 |
+
if st.button("⬅️ Back to Image Operations"):
|
| 1553 |
navigate_to("image_operations") # Previous page: Explore Image Creation and Manipulation
|
| 1554 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 1555 |
+
|
| 1556 |
with col4:
|
| 1557 |
+
if st.button("➡️ Explore Video Transformations"):
|
| 1558 |
+
navigate_to("video_transformations") # Next page: Explore Video Transformations with OpenCV
|
| 1559 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 1560 |
|
| 1561 |
|
| 1562 |
elif st.session_state.current_page == "image_transformations":
|
|
|
|
| 1973 |
st.warning("Please select a valid transformation type to proceed.")
|
| 1974 |
|
| 1975 |
col1, col2 = st.columns(2)
|
| 1976 |
+
|
| 1977 |
+
# First row: Colab Notes and Unstructured Data
|
| 1978 |
with col1:
|
| 1979 |
st.markdown("""
|
| 1980 |
+
<a href="https://colab.research.google.com/drive/19mQM-7VY0F0y9NyecrhbU5kyOY9j9oIk?usp=sharing" target="_blank" title="Open Colab Notes">
|
| 1981 |
<button style="background-color: #4CAF50; color: white; padding: 10px; font-size: 16px; border: none; cursor: pointer;">
|
| 1982 |
Colab Notes
|
| 1983 |
</button>
|
| 1984 |
</a>
|
| 1985 |
""", unsafe_allow_html=True)
|
| 1986 |
+
|
| 1987 |
with col2:
|
| 1988 |
+
if st.button("Back to Unstructured Data"):
|
| 1989 |
st.session_state.current_page = "main"
|
| 1990 |
+
st.query_params.update({})
|
| 1991 |
+
|
| 1992 |
+
# Second row: Back to and Explore Navigation
|
| 1993 |
col3, col4 = st.columns(2)
|
| 1994 |
with col3:
|
| 1995 |
+
if st.button("⬅️ Back to Video Processing"):
|
| 1996 |
st.session_state.current_page = "video_processing"
|
| 1997 |
+
st.query_params.update({})
|
| 1998 |
with col4:
|
| 1999 |
+
if st.button("➡️ Explore OpenCV Projects"):
|
| 2000 |
st.session_state.current_page = "opencv_projects"
|
| 2001 |
+
st.query_params.update({})
|
| 2002 |
+
|
| 2003 |
|
| 2004 |
|
| 2005 |
elif st.session_state.current_page == "opencv_projects":
|
|
|
|
| 2093 |
|
| 2094 |
# Column 1 - Button to go back to the Image Transformations page
|
| 2095 |
with col1:
|
| 2096 |
+
if st.button("⬅️ Image Transformations with OpenCV", help="Navigate back to the Image Transformations section"):
|
| 2097 |
navigate_to("image_transformations")
|
| 2098 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2099 |
|
| 2100 |
# Column 2 - Button for the main page (Images & Videos)
|
| 2101 |
with col2:
|
| 2102 |
+
if st.button("Unstructured Data", help="Navigate to the main page for Images & Videos"):
|
| 2103 |
+
navigate_to("main")
|
| 2104 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2105 |
+
|
| 2106 |
|
| 2107 |
|
| 2108 |
|
|
|
|
| 2299 |
|
| 2300 |
with col2:
|
| 2301 |
if st.button("⬅️ Back to Previous Page"):
|
| 2302 |
+
st.session_state.current_page = "main"
|
| 2303 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2304 |
+
|
| 2305 |
|
| 2306 |
|
| 2307 |
#--------------------------------------------------------- Json --------------------------------------------------------------------------------
|
|
|
|
| 2635 |
|
| 2636 |
with col2:
|
| 2637 |
if st.button("⬅️ Back to Previous Page"):
|
| 2638 |
+
st.session_state.current_page = "main"
|
| 2639 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2640 |
+
|
| 2641 |
|
| 2642 |
|
| 2643 |
#--------------------------------------------------------- XML -------------------------------------------------------------------------------
|
|
|
|
| 2789 |
|
| 2790 |
with col2:
|
| 2791 |
if st.button("⬅️ Back to Previous Page"):
|
| 2792 |
+
st.session_state.current_page = "main"
|
| 2793 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2794 |
+
|
| 2795 |
|
| 2796 |
#--------------------------------------------------------- HTML --------------------------------------------------------------------------------
|
| 2797 |
|
|
|
|
| 2859 |
data.to_html('output.html', index=False)
|
| 2860 |
""", language="python")
|
| 2861 |
|
|
|
|
| 2862 |
col1, col2 = st.columns(2)
|
| 2863 |
|
| 2864 |
with col1:
|
|
|
|
| 2872 |
|
| 2873 |
with col2:
|
| 2874 |
if st.button("⬅️ Back to Previous Page"):
|
| 2875 |
+
st.session_state.current_page = "main"
|
| 2876 |
+
st.query_params.update({}) # Ensure scroll resets
|
| 2877 |
+
|