File size: 4,362 Bytes
dc2b6ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58d9a92
dc2b6ec
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import pandas as pd
import streamlit as st
from cluster_model import *
from streamlit_folium import folium_static

#SET PAGE WIDE
st.set_page_config(page_title='Identifying Commercial Centre Using Machine Learning',layout="centered")


st.markdown("""
        <style>
               .css-18e3th9 {
                    padding-top: 0rem;
                    padding-bottom: 10rem;
                    padding-left: 5rem;
                    padding-right: 5rem;
                }
               .css-1d391kg {
                    padding-top: 3.5rem;
                    padding-right: 1rem;
                    padding-bottom: 3.5rem;
                    padding-left: 1rem;
                }
        </style>
        """, unsafe_allow_html=True)

st.sidebar.title("About")
st.sidebar.info(
    """
    [GitHub repository](https://github.com/Sowmyad15/Identifying-Commercial-Centers-Using-Machine-Learning)
    """
)

st.sidebar.title("Contact")
st.sidebar.info(
    """
    Sowmya D
    [GitHub](https://github.com/Sowmyad15) | [LinkedIn](https://www.linkedin.com/in/sowmya-d-4b01711b2/)
    """
)
#Title of the page with CSS

st.markdown(""" <style> .font {
        font-size:40px ; font-family: 'Verdana'; color: 	#000000;} 
        </style> """, unsafe_allow_html=True)
st.markdown('<p class="font">Identifying Commercial Centers</p>', unsafe_allow_html=True) 

with st.expander("About this project"):
    st.info("""Even though several global data are available regarding geolocations, demography of the planet, they are of not in supervised structure from which insights cannot be drawn. A Commercial Centre contains a high concentration of business, civic and cultural activities, also known as downtown. It is important to get to know the commercial city centres if you want to start any business as it also helps in identifying customer needs and in developing your business too.
To identify commercial centre of any city, clustering of Point of Interest(POI) of the city data with the correct amenities of interest is needed. 
This web app provides the Commercial centre of the city using Machine Learning.
 """)

city = st.text_input('Enter City Name:',help="City name is case sensitive, Kindly provide the exact name")

if city:
        with st.spinner("Fetching City Data"):
            try:
                df=fetch_city_data(city)

                st.header("Point of Interest in "+city)
                st.markdown("The following data represents the Point of Interest Data of "+city)
                st.dataframe(df,width=1000,height=500)
                x=cluster_models(df)
                with st.expander("How it works?"):
                    st.success("""A city from user is taken, whose data is fetched from Open Street Map (OSM), 
                    after pre-processing the data, outliers are removed using Density-Based Spatial Clustering of Applications with Noise (DBSCAN) and 
                    clusters are plotted on map using K-Means.Along with identifying the commercial centre, it also forms clusters of top 5 amenities in the city too.""")

                st.header("Commercial Centers in "+city)
                folium_static(mapplot(x[0],x[1],x[2]),height=500)

                dx=amenity_df(df)

                top5name=list(dx.iloc[:,0])

                barplt=barplot(dx)

                tab1, tab2,tab3,tab4,tab5,tab6= st.tabs(["📈 Chart",top5name[0],top5name[1],top5name[2],top5name[3],top5name[4]])

                with tab1:
                    st.subheader("Top Amenities")
                    st.plotly_chart(barplt)

                with tab2:
                    st.header(top5name[0])
                    folium_static(top5(dx,0),width=725,height=500)

                with tab3:
                    st.header(top5name[1])
                    folium_static(top5(dx,1),width=725,height=500)

                with tab4:
                    st.header(top5name[2])
                    folium_static(top5(dx,2),width=725,height=500)

                with tab5:
                    st.header(top5name[3])
                    folium_static(top5(dx,3),width=725,height=500)

                with tab6:
                    st.header(top5name[4])
                    folium_static(top5(dx,4),width=725,height=500)

            except KeyError:
                st.error("Oops Couldnt find city details")