Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,35 +12,38 @@ def main():
|
|
| 12 |
with col1:
|
| 13 |
destination = st.text_input("Destination")
|
| 14 |
category = st.selectbox("Category",('Beach', 'Market', 'Park', 'Tourist place', 'Temple', 'Museum', 'Cafe'))
|
| 15 |
-
|
| 16 |
-
st.
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# load recommendations data
|
| 19 |
-
|
| 20 |
|
| 21 |
# filter recommendations based on user input
|
| 22 |
-
|
| 23 |
(recommendations['Category'] == category)]
|
| 24 |
|
| 25 |
# display recommendations on map
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
# display recommendations in a list
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
if __name__ == "__main__":
|
| 44 |
main()
|
| 45 |
|
| 46 |
|
|
|
|
|
|
| 12 |
with col1:
|
| 13 |
destination = st.text_input("Destination")
|
| 14 |
category = st.selectbox("Category",('Beach', 'Market', 'Park', 'Tourist place', 'Temple', 'Museum', 'Cafe'))
|
| 15 |
+
|
| 16 |
+
if st.button("Submit"):
|
| 17 |
+
st.write(f"Destination: {destination}")
|
| 18 |
+
st.write(f"Category: {category}")
|
| 19 |
|
| 20 |
# load recommendations data
|
| 21 |
+
recommendations = pd.read_csv('recommendations.csv')
|
| 22 |
|
| 23 |
# filter recommendations based on user input
|
| 24 |
+
filtered_recommendations = recommendations[(recommendations['Destination'] == destination) &
|
| 25 |
(recommendations['Category'] == category)]
|
| 26 |
|
| 27 |
# display recommendations on map
|
| 28 |
+
map_center = filtered_recommendations[['Latitude', 'Longitude']].mean().values.tolist()
|
| 29 |
+
my_map = folium.Map(location=map_center, zoom_start=12, tiles='OpenStreetMap')
|
| 30 |
+
for _, row in filtered_recommendations.iterrows():
|
| 31 |
+
folium.Marker([row['Latitude'], row['Longitude']],
|
| 32 |
+
popup=row['Name'],
|
| 33 |
+
tooltip=row['Name']).add_to(my_map)
|
| 34 |
|
| 35 |
+
with col2:
|
| 36 |
+
st.write("Here are some recommendations on a map:")
|
| 37 |
+
folium_static(my_map)
|
| 38 |
|
| 39 |
# display recommendations in a list
|
| 40 |
+
st.write("Here are some recommendations:")
|
| 41 |
+
table = filtered_recommendations[['Name','Description','Reviews','Google Rating(out of 5)']]
|
| 42 |
+
table_html = table.to_html(index=False, escape=False)
|
| 43 |
+
st.write(table_html, unsafe_allow_html=True)
|
| 44 |
|
| 45 |
if __name__ == "__main__":
|
| 46 |
main()
|
| 47 |
|
| 48 |
|
| 49 |
+
|