Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,16 @@ with open("./max_dict.json", "r") as f:
|
|
16 |
with open("./cities_geo.json", "r") as f:
|
17 |
cities_geo = json.load(f)
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
# Create two columns: one for the city and one for the map
|
20 |
col1, col2 = st.columns([1, 2]) # Adjust the width ratios as needed
|
21 |
|
@@ -25,6 +35,8 @@ with col1:
|
|
25 |
with st.container(height=800, border=False):
|
26 |
city = st.selectbox('City', list(cities_geo.keys())) # Display city dropdown in the first column
|
27 |
waterfront = st.checkbox('Waterfront', value=False)
|
|
|
|
|
28 |
bedrooms = st.slider('Bedrooms', min_value=min_dict['bedrooms'], max_value=max_dict['bedrooms'], value=3)
|
29 |
bathrooms = st.slider('Bathrooms', min_value=min_dict['bathrooms'], max_value=max_dict['bathrooms'], value=2)
|
30 |
sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=1000)
|
@@ -36,6 +48,7 @@ with col1:
|
|
36 |
sqft_basement = st.slider('Square Feet (Basement)', min_value=min_dict['sqft_basement'], max_value=max_dict['sqft_basement'], value=0)
|
37 |
yr_built = st.slider('Year Built', min_value=min_dict['yr_built'], max_value=max_dict['yr_built'], value=2000)
|
38 |
yr_renovated = st.slider('Year Renovated', min_value=min_dict['yr_renovated'], max_value=min_dict['yr_renovated'], value=2010)
|
|
|
39 |
|
40 |
st.markdown('</div>', unsafe_allow_html=True)
|
41 |
|
@@ -70,6 +83,4 @@ with col2:
|
|
70 |
f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
|
71 |
unsafe_allow_html=True)
|
72 |
map_data = pd.DataFrame(cities_geo[city])
|
73 |
-
st.map(map_data, zoom=11)
|
74 |
-
# with st.container(height=500, border=False):
|
75 |
-
|
|
|
16 |
with open("./cities_geo.json", "r") as f:
|
17 |
cities_geo = json.load(f)
|
18 |
|
19 |
+
# Custom CSS to adjust the slider width
|
20 |
+
st.markdown("""
|
21 |
+
<style>
|
22 |
+
.slider-container {
|
23 |
+
max-width: 400px; /* Adjust the width to your preference */
|
24 |
+
margin-bottom: 20px;
|
25 |
+
}
|
26 |
+
</style>
|
27 |
+
""", unsafe_allow_html=True)
|
28 |
+
|
29 |
# Create two columns: one for the city and one for the map
|
30 |
col1, col2 = st.columns([1, 2]) # Adjust the width ratios as needed
|
31 |
|
|
|
35 |
with st.container(height=800, border=False):
|
36 |
city = st.selectbox('City', list(cities_geo.keys())) # Display city dropdown in the first column
|
37 |
waterfront = st.checkbox('Waterfront', value=False)
|
38 |
+
|
39 |
+
st.markdown('<div class="slider-container">', unsafe_allow_html=True)
|
40 |
bedrooms = st.slider('Bedrooms', min_value=min_dict['bedrooms'], max_value=max_dict['bedrooms'], value=3)
|
41 |
bathrooms = st.slider('Bathrooms', min_value=min_dict['bathrooms'], max_value=max_dict['bathrooms'], value=2)
|
42 |
sqft_living = st.slider('Square Feet (Living)', min_value=min_dict['sqft_living'], max_value=max_dict['sqft_living'], value=1000)
|
|
|
48 |
sqft_basement = st.slider('Square Feet (Basement)', min_value=min_dict['sqft_basement'], max_value=max_dict['sqft_basement'], value=0)
|
49 |
yr_built = st.slider('Year Built', min_value=min_dict['yr_built'], max_value=max_dict['yr_built'], value=2000)
|
50 |
yr_renovated = st.slider('Year Renovated', min_value=min_dict['yr_renovated'], max_value=min_dict['yr_renovated'], value=2010)
|
51 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
52 |
|
53 |
st.markdown('</div>', unsafe_allow_html=True)
|
54 |
|
|
|
83 |
f"<h1 style='font-size: 24px;'>Predicted Price: ${predicted_price[0][0]:,.2f}</h1>",
|
84 |
unsafe_allow_html=True)
|
85 |
map_data = pd.DataFrame(cities_geo[city])
|
86 |
+
st.map(map_data, zoom=11)
|
|
|
|