File size: 1,878 Bytes
af5e001
 
 
 
 
 
 
 
 
 
 
 
 
d7c7c14
8cf2edc
 
 
 
af5e001
 
8cf2edc
af5e001
 
8cf2edc
af5e001
 
 
8cf2edc
 
 
 
 
 
af5e001
8cf2edc
 
 
af5e001
 
8cf2edc
 
 
 
af5e001
 
 
 
 
8cf2edc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import streamlit as st
import pandas as pd
import folium
from streamlit_folium import folium_static

def main():
    st.title("Place Recommender System")
    st.write("Please enter your trip information below:")
    
    # use columns to display the inputs and map/recommendations side by side
    col1, col2 = st.columns(2)
    with col1:
        destination = st.text_input("Destination")
        category = st.selectbox("Category",('Beach', 'Market', 'Park', 'Tourist place', 'Temple', 'Museum', 'Cafe','Hotels ','Restaurants'))

    if st.button("Submit"):
        st.write(f"Destination: {destination}")
        st.write(f"Category: {category}")
        
        # load recommendations data
        recommendations = pd.read_csv('recommendations.csv')

        # filter recommendations based on user input
        filtered_recommendations = recommendations[(recommendations['Destination'] == destination) & 
                                                   (recommendations['Category'] == category)]

        # display recommendations on map
        map_center = filtered_recommendations[['Latitude', 'Longitude']].mean().values.tolist()
        my_map = folium.Map(location=map_center, zoom_start=12, tiles='OpenStreetMap')
        for _, row in filtered_recommendations.iterrows():
        	folium.Marker([row['Latitude'], row['Longitude']], 
		popup=row['Name'], 
		tooltip=row['Name']).add_to(my_map)

        with col2:
        	st.write("Here are some recommendations on a map:")
        	folium_static(my_map)

        # display recommendations in a list
        st.write("Here are some recommendations:")
        table = filtered_recommendations[['Name','Description','Reviews','Google Rating(out of 5)']]
        table_html = table.to_html(index=False, escape=False)
        st.write(table_html, unsafe_allow_html=True)

if __name__ == "__main__":
    main()