LakshmiHarika commited on
Commit
4f180b3
·
verified ·
1 Parent(s): 84eff29

Update pages/Data Collection.py

Browse files
Files changed (1) hide show
  1. pages/Data Collection.py +35 -24
pages/Data Collection.py CHANGED
@@ -67,7 +67,11 @@ data_type = st.radio(
67
  )
68
 
69
  # Structured Data Section
70
- if data_type == "Structured Data":
 
 
 
 
71
  st.markdown("""
72
  <div style="text-align: left; margin-top: 20px;">
73
  <h3 style="color: #e25822;">What is Structured Data?</h3>
@@ -120,7 +124,7 @@ if data_type == "Structured Data":
120
  <h4 style="color: #5b2c6f;">Data Formats in Structured Data:</h4>
121
  </div>
122
  """, unsafe_allow_html=True)
123
-
124
  st.write("Click to explore Structured Data Formats:")
125
  if st.button("Structured Data Formats"):
126
  st.write("Select a format to explore:")
@@ -130,28 +134,35 @@ if data_type == "Structured Data":
130
 
131
  with col1:
132
  if st.button("Explore Excel"):
133
- st.markdown("""
134
- <div style="text-align: left; margin-top: 20px;">
135
- <h3 style="color: #e25822;">Exploring Excel</h3>
136
- </div>
137
- """, unsafe_allow_html=True)
138
-
139
- st.write("""
140
- Excel is one of the most widely used tools for handling structured data. It supports features like:
141
- - Tabular data representation.
142
- - Complex computations using formulas.
143
- - Data visualization with charts and graphs.
144
- """)
145
-
146
- # Add Excel file uploader and display content
147
- uploaded_file = st.file_uploader("Upload an Excel file", type=["xlsx", "xls"])
148
- if uploaded_file:
149
- try:
150
- df = pd.read_excel(uploaded_file)
151
- st.write("Preview of the uploaded file:")
152
- st.dataframe(df)
153
- except Exception as e:
154
- st.error("An error occurred while reading the file. Please ensure it is a valid Excel file.")
 
 
 
 
 
 
 
155
 
156
 
157
  elif data_type == "Unstructured Data":
 
67
  )
68
 
69
  # Structured Data Section
70
+ # Ensure session state is initialized
71
+ if "explore_excel" not in st.session_state:
72
+ st.session_state.explore_excel = False
73
+
74
+ if data_type == "Structured Data" and not st.session_state.explore_excel:
75
  st.markdown("""
76
  <div style="text-align: left; margin-top: 20px;">
77
  <h3 style="color: #e25822;">What is Structured Data?</h3>
 
124
  <h4 style="color: #5b2c6f;">Data Formats in Structured Data:</h4>
125
  </div>
126
  """, unsafe_allow_html=True)
127
+
128
  st.write("Click to explore Structured Data Formats:")
129
  if st.button("Structured Data Formats"):
130
  st.write("Select a format to explore:")
 
134
 
135
  with col1:
136
  if st.button("Explore Excel"):
137
+ st.session_state.explore_excel = True
138
+
139
+ if st.session_state.explore_excel:
140
+ st.markdown("""
141
+ <div style="text-align: left; margin-top: 20px;">
142
+ <h3 style="color: #e25822;">Exploring Excel</h3>
143
+ </div>
144
+ """, unsafe_allow_html=True)
145
+
146
+ st.write("""
147
+ Excel is one of the most widely used tools for handling structured data. It supports features like:
148
+ - Tabular data representation.
149
+ - Complex computations using formulas.
150
+ - Data visualization with charts and graphs.
151
+ """)
152
+
153
+ # Add Excel file uploader and display content
154
+ uploaded_file = st.file_uploader("Upload an Excel file", type=["xlsx", "xls"])
155
+ if uploaded_file:
156
+ try:
157
+ df = pd.read_excel(uploaded_file)
158
+ st.write("Preview of the uploaded file:")
159
+ st.dataframe(df)
160
+ except Exception as e:
161
+ st.error("An error occurred while reading the file. Please ensure it is a valid Excel file.")
162
+
163
+ # Add a "Go Back" button
164
+ if st.button("Go Back"):
165
+ st.session_state.explore_excel = False
166
 
167
 
168
  elif data_type == "Unstructured Data":