zayeem00 commited on
Commit
7ad5650
·
verified ·
1 Parent(s): 4c4dfb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -10,6 +10,11 @@ st.set_page_config(layout="centered", page_title="Restaurant Data Viewer")
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(
15
  """
@@ -90,7 +95,7 @@ def authenticate(username, password):
90
 
91
  # Function to trigger rerun
92
  def trigger_rerun():
93
- st.experimental_set_query_params(rerun=str(pd.Timestamp.now()))
94
 
95
  # Authentication block
96
  if not st.session_state.authenticated:
@@ -100,7 +105,7 @@ if not st.session_state.authenticated:
100
  if st.button("Login"):
101
  if authenticate(username, password):
102
  st.session_state.authenticated = True
103
- trigger_rerun() # Force rerun
104
  else:
105
  st.error("Invalid username or password")
106
  else:
@@ -124,10 +129,8 @@ else:
124
  f.write(uploaded_file.getbuffer())
125
 
126
  st.success(f"File '{uploaded_file.name}' uploaded successfully.")
127
-
128
  df = load_data(file_path)
129
  st.session_state.df = df
130
-
131
  except Exception as e:
132
  st.error(f"An error occurred: {e}")
133
 
@@ -180,13 +183,13 @@ else:
180
  name_filter = st.text_input("Name contains")
181
  with col2:
182
  # Filter by Cuisine
183
- cuisine_filter = st.multiselect("Cuisine", sorted(pd.unique(df['Cuisine'])))
184
  with col3:
185
  # Filter by Location
186
- location_filter = st.multiselect("Location", pd.unique(df['Location']))
187
  with col4:
188
  # Filter by Restaurant Type
189
- restaurant_type_filter = st.multiselect("Restaurant Type", pd.unique(df['Restaurant Type']))
190
  with col5:
191
  # Filter by Expiry Date
192
  expiry_date_filter = st.date_input("Expiry Date", [])
 
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(
20
  """
 
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:
 
105
  if st.button("Login"):
106
  if authenticate(username, password):
107
  st.session_state.authenticated = True
108
+ trigger_rerun()
109
  else:
110
  st.error("Invalid username or password")
111
  else:
 
129
  f.write(uploaded_file.getbuffer())
130
 
131
  st.success(f"File '{uploaded_file.name}' uploaded successfully.")
 
132
  df = load_data(file_path)
133
  st.session_state.df = df
 
134
  except Exception as e:
135
  st.error(f"An error occurred: {e}")
136
 
 
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", [])