Update src/streamlit_app.py
Browse files- src/streamlit_app.py +1 -5
src/streamlit_app.py
CHANGED
|
@@ -235,7 +235,7 @@ def filter_menus(menus, search_term="", selected_tags=None, price_range=(0, 1000
|
|
| 235 |
def calculate_menu_distances(filtered_menus, buildings, graph, user_location):
|
| 236 |
"""Hitung jarak dari lokasi pengguna ke lokasi menu yang difilter"""
|
| 237 |
# Jalankan Dijkstra sekali saja untuk seluruh node
|
| 238 |
-
all_distances =
|
| 239 |
menu_distances = []
|
| 240 |
|
| 241 |
for _, menu in filtered_menus.iterrows():
|
|
@@ -259,10 +259,6 @@ def calculate_menu_distances(filtered_menus, buildings, graph, user_location):
|
|
| 259 |
})
|
| 260 |
return sorted(menu_distances, key=lambda x: x['distance'])
|
| 261 |
|
| 262 |
-
@st.cache_data
|
| 263 |
-
def get_all_distances(graph, user_location, weight='length'):
|
| 264 |
-
return nx.single_source_dijkstra_path_length(graph, user_location, weight=weight)
|
| 265 |
-
|
| 266 |
def has_user_input(user_location, search_term, selected_tags, price_range, default_price_range):
|
| 267 |
"""Cek apakah pengguna sudah memberikan input untuk pencarian menu"""
|
| 268 |
has_location = user_location is not None
|
|
|
|
| 235 |
def calculate_menu_distances(filtered_menus, buildings, graph, user_location):
|
| 236 |
"""Hitung jarak dari lokasi pengguna ke lokasi menu yang difilter"""
|
| 237 |
# Jalankan Dijkstra sekali saja untuk seluruh node
|
| 238 |
+
all_distances = nx.single_source_dijkstra_path_length(graph, user_location, weight='length')
|
| 239 |
menu_distances = []
|
| 240 |
|
| 241 |
for _, menu in filtered_menus.iterrows():
|
|
|
|
| 259 |
})
|
| 260 |
return sorted(menu_distances, key=lambda x: x['distance'])
|
| 261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
def has_user_input(user_location, search_term, selected_tags, price_range, default_price_range):
|
| 263 |
"""Cek apakah pengguna sudah memberikan input untuk pencarian menu"""
|
| 264 |
has_location = user_location is not None
|