zayeem00 commited on
Commit
69cfb02
·
verified ·
1 Parent(s): 7ad5650

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -16
app.py CHANGED
@@ -8,12 +8,7 @@ st.set_page_config(layout="centered", page_title="Restaurant Data Viewer")
8
 
9
  # URLs for the logos
10
  MAIN_LOGO_URL = "https://islamictrusthk.org/assets/images/top-logo.png"
11
- SIDEBAR_LOGO_URL = "https://bot.islamictrusthk.org/assets/content_files/20240606095159123011.png"
12
-
13
- # Print the versions of the packages
14
- st.write(f"Streamlit version: {st.__version__}")
15
- st.write(f"Pandas version: {pd.__version__}")
16
- st.write(f"Numpy version: {np.__version__}")
17
 
18
  # Inject custom CSS for better mobile compatibility
19
  st.markdown(
@@ -95,7 +90,8 @@ def authenticate(username, password):
95
 
96
  # Function to trigger rerun
97
  def trigger_rerun():
98
- st.experimental_rerun()
 
99
 
100
  # Authentication block
101
  if not st.session_state.authenticated:
@@ -176,21 +172,18 @@ else:
176
  # Filter functionality
177
  st.subheader("Filters")
178
  # Use columns for a more responsive layout
179
- col1, col2, col3, col4, col5 = st.columns(5)
180
 
181
  with col1:
182
  # Filter by Name
183
  name_filter = st.text_input("Name contains")
184
  with col2:
185
- # Filter by Cuisine
186
- cuisine_filter = st.multiselect("Cuisine", sorted(df['Cuisine'].drop_duplicates().unique()))
187
- with col3:
188
  # Filter by Location
189
  location_filter = st.multiselect("Location", df['Location'].drop_duplicates())
190
- with col4:
191
  # Filter by Restaurant Type
192
  restaurant_type_filter = st.multiselect("Restaurant Type", df['Restaurant Type'].drop_duplicates())
193
- with col5:
194
  # Filter by Expiry Date
195
  expiry_date_filter = st.date_input("Expiry Date", [])
196
 
@@ -199,8 +192,6 @@ else:
199
 
200
  if name_filter:
201
  filtered_df = filtered_df[filtered_df['Name'].str.contains(name_filter, case=False, na=False)]
202
- if cuisine_filter:
203
- filtered_df = filtered_df[filtered_df['Cuisine'].isin(cuisine_filter)]
204
  if location_filter:
205
  filtered_df = filtered_df[filtered_df['Location'].isin(location_filter)]
206
  if restaurant_type_filter:
@@ -228,4 +219,4 @@ else:
228
  mime='text/csv',
229
  )
230
  else:
231
- st.info("No data matches the filter criteria.")
 
8
 
9
  # URLs for the logos
10
  MAIN_LOGO_URL = "https://islamictrusthk.org/assets/images/top-logo.png"
11
+ SIDEBAR_LOGO_URL = "https://bot.islamictrusthk.org/assets/content_files/20240606095159123011.png"
 
 
 
 
 
12
 
13
  # Inject custom CSS for better mobile compatibility
14
  st.markdown(
 
90
 
91
  # Function to trigger rerun
92
  def trigger_rerun():
93
+ st.set_query_params(rerun=str(pd.Timestamp.now()))
94
+ st.experimental_rerun() # Force page reload
95
 
96
  # Authentication block
97
  if not st.session_state.authenticated:
 
172
  # Filter functionality
173
  st.subheader("Filters")
174
  # Use columns for a more responsive layout
175
+ col1, col2, col3, col4 = st.columns(4)
176
 
177
  with col1:
178
  # Filter by Name
179
  name_filter = st.text_input("Name contains")
180
  with col2:
 
 
 
181
  # Filter by Location
182
  location_filter = st.multiselect("Location", df['Location'].drop_duplicates())
183
+ with col3:
184
  # Filter by Restaurant Type
185
  restaurant_type_filter = st.multiselect("Restaurant Type", df['Restaurant Type'].drop_duplicates())
186
+ with col4:
187
  # Filter by Expiry Date
188
  expiry_date_filter = st.date_input("Expiry Date", [])
189
 
 
192
 
193
  if name_filter:
194
  filtered_df = filtered_df[filtered_df['Name'].str.contains(name_filter, case=False, na=False)]
 
 
195
  if location_filter:
196
  filtered_df = filtered_df[filtered_df['Location'].isin(location_filter)]
197
  if restaurant_type_filter:
 
219
  mime='text/csv',
220
  )
221
  else:
222
+ st.info("No data matches the filter criteria.")