shrut27 commited on
Commit
8cf2edc
·
1 Parent(s): af5e001

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -17
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
- st.write(f"Destination: {destination}")
16
- st.write(f"Category: {category}")
 
 
17
 
18
  # load recommendations data
19
- recommendations = pd.read_csv('recommendations.csv')
20
 
21
  # filter recommendations based on user input
22
- filtered_recommendations = recommendations[(recommendations['Destination'] == destination) &
23
  (recommendations['Category'] == category)]
24
 
25
  # display recommendations on map
26
- map_center = filtered_recommendations[['Latitude', 'Longitude']].mean().values.tolist()
27
- my_map = folium.Map(location=map_center, zoom_start=12, tiles='OpenStreetMap')
28
- for _, row in filtered_recommendations.iterrows():
29
- folium.Marker([row['Latitude'], row['Longitude']],
30
- popup=row['Name'],
31
- tooltip=row['Name']).add_to(my_map)
32
 
33
- with col2:
34
- st.write("Here are some recommendations on a map:")
35
- folium_static(my_map)
36
 
37
  # display recommendations in a list
38
- st.write("Here are some recommendations:")
39
- table = filtered_recommendations[['Name','Description','Reviews','Google Rating(out of 5)']]
40
- table_html = table.to_html(index=False, escape=False)
41
- st.write(table_html, unsafe_allow_html=True)
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
+