LakshmiHarika commited on
Commit
3b694d5
·
verified ·
1 Parent(s): bf18dc4

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +61 -3
pages/Data Collection.py CHANGED
@@ -258,10 +258,16 @@ elif st.session_state.current_page == "explore_excel":
258
  if st.button("Go Back"):
259
  navigate_to("main")
260
 
 
 
 
 
261
  elif st.session_state.current_page == "explore_images_video":
262
  st.markdown("""
263
  <h2 style="color: #BB3385;">Introduction to Images and Videos📸🖼️</h2>
264
  """, unsafe_allow_html=True)
 
 
265
  st.markdown("""
266
  <div style="text-align: left; margin-top: 20px;">
267
  <h3 style="color: #5b2c6f;">What is an Image?📊✨</h3>
@@ -272,22 +278,74 @@ elif st.session_state.current_page == "explore_images_video":
272
  </p>
273
  </div>
274
  """, unsafe_allow_html=True)
 
 
275
  st.markdown("""
276
  <div style="text-align: left; margin-top: 20px;">
277
  <h3 style="color: #5b2c6f;">What is a Video?🎥✨</h3>
278
  <p style="font-size: 16px; color: #333;">
279
- 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
 
280
  sequentially, they show continuous movement. Videos typically have a frame rate (e.g., 30 frames
281
- per second, 60 frames per second), which determines how many frames are displayed per second, influencing the smoothness
282
- of the video. Formats such as MP4, AVI, and MOV are commonly used for storing and sharing videos.
283
  </p>
284
  </div>
285
  """, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
  if st.button("Go Back"):
287
  navigate_to("main")
288
 
289
 
290
 
 
291
  elif st.session_state.current_page == "explore_audio":
292
  st.markdown("""
293
  <h3 style="color: #e25822;">Exploring Audio</h3>
 
258
  if st.button("Go Back"):
259
  navigate_to("main")
260
 
261
+ import streamlit as st
262
+ import matplotlib.pyplot as plt
263
+ import numpy as np
264
+
265
  elif st.session_state.current_page == "explore_images_video":
266
  st.markdown("""
267
  <h2 style="color: #BB3385;">Introduction to Images and Videos📸🖼️</h2>
268
  """, unsafe_allow_html=True)
269
+
270
+ # Subheading 1: What is an Image?
271
  st.markdown("""
272
  <div style="text-align: left; margin-top: 20px;">
273
  <h3 style="color: #5b2c6f;">What is an Image?📊✨</h3>
 
278
  </p>
279
  </div>
280
  """, unsafe_allow_html=True)
281
+
282
+ # Subheading 2: What is a Video?
283
  st.markdown("""
284
  <div style="text-align: left; margin-top: 20px;">
285
  <h3 style="color: #5b2c6f;">What is a Video?🎥✨</h3>
286
  <p style="font-size: 16px; color: #333;">
287
+ A video is a collection of images, often referred to as frames, displayed one after another quickly
288
+ to show continuous movement. Each frame captures a moment in time, and when these frames are played
289
  sequentially, they show continuous movement. Videos typically have a frame rate (e.g., 30 frames
290
+ per second or 60 frames per second), which determines how many frames are displayed per second.
291
+ Common video formats include MP4, AVI, and MOV.
292
  </p>
293
  </div>
294
  """, unsafe_allow_html=True)
295
+
296
+ # Subheading 3: Why is an Image Called a Grid-Like Structure?
297
+ st.markdown("""
298
+ <div style="text-align: left; margin-top: 20px;">
299
+ <h3 style="color: #5b2c6f;">Why is an Image Called a Grid-Like Structure?🔲✨</h3>
300
+ <p style="font-size: 16px; color: #333;">
301
+ Images are called grid-like structures because they are composed of pixels arranged in rows and columns,
302
+ forming a rectangular grid. Each pixel contains information about shape, color, and patterns, which
303
+ together define the image's content. The total number of pixels is determined by the image's height
304
+ and width (resolution), and a higher resolution provides better clarity.
305
+ </p>
306
+ <p style="font-size: 16px; color: #333;">
307
+ In images, pixels act as features, and the entire grid represents a single data point. This combination
308
+ of features and data points gives images their grid-like nature.
309
+ </p>
310
+ <p style="font-size: 16px; color: #333;">
311
+ While images and tabular data are both grid-like, the difference lies in interpretation: in images, the
312
+ grid represents one data point, while in tabular data, rows represent data points, and columns represent features.
313
+ </p>
314
+ </div>
315
+ """, unsafe_allow_html=True)
316
+
317
+ # Visualization for Grid-Like Structure
318
+ st.markdown("<h4 style='color: #BB3385;'>Image as a Grid Structure</h4>", unsafe_allow_html=True)
319
+ height, width = 6, 6
320
+ grid = np.random.rand(height, width)
321
+ fig, ax = plt.subplots()
322
+ cax = ax.imshow(grid, cmap='viridis')
323
+
324
+ # Annotate the grid with pixel labels
325
+ for i in range(height):
326
+ for j in range(width):
327
+ ax.text(j, i, f'{grid[i, j]:.2f}', ha='center', va='center', color='white', fontsize=6)
328
+
329
+ # Set axis labels and title
330
+ ax.set_title("Image as a Grid-Like Structure", fontsize=12)
331
+ ax.set_xlabel("Width (Pixels)", fontsize=10)
332
+ ax.set_ylabel("Height (Pixels)", fontsize=10)
333
+ ax.set_xticks(range(width))
334
+ ax.set_yticks(range(height))
335
+ ax.set_xticklabels([f'Col {j+1}' for j in range(width)])
336
+ ax.set_yticklabels([f'Row {i+1}' for i in range(height)])
337
+ ax.grid(color='white', linestyle='-', linewidth=1)
338
+ fig.colorbar(cax, ax=ax, orientation='vertical', label='Pixel Value')
339
+
340
+ st.pyplot(fig)
341
+
342
+ # Go Back Button
343
  if st.button("Go Back"):
344
  navigate_to("main")
345
 
346
 
347
 
348
+
349
  elif st.session_state.current_page == "explore_audio":
350
  st.markdown("""
351
  <h3 style="color: #e25822;">Exploring Audio</h3>