Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import pandas as pd | |
| def get_market_submarket(df, google_ola): | |
| filtered_row = df[df['google_ola'] == google_ola].iloc[0] | |
| return filtered_row['rent_combined'], filtered_row['building_sf'], filtered_row['market_costar'], filtered_row['submarket_costar'] | |
| def main(): | |
| st.set_page_config(initial_sidebar_state="collapsed", layout="wide") | |
| st.session_state['user_select_value'] = "" | |
| st.session_state['year_buit'] = 1999 | |
| st.session_state['submarket_val'] = "" | |
| st.session_state['market_val'] = "" | |
| def display_list_and_input(): | |
| option_choice = st.selectbox("Select a property address", df_options) | |
| return option_choice | |
| if 'user_select_value' not in st.session_state: | |
| st.session_state['user_select_value'] = "" | |
| if 'property_lsf' not in st.session_state: | |
| st.session_state['property_lsf'] = 0 | |
| if 'execution_dates' not in st.session_state: | |
| st.session_state['execution_dates'] = 2014 | |
| if 'LSF' not in st.session_state: | |
| st.session_state['LSF'] = 75000 | |
| if 'prediction' not in st.session_state: | |
| st.session_state['prediction'] = 0 | |
| st.title("Search") | |
| df_properties = pd.read_csv("atlanta_data_new.csv", encoding='utf-8') | |
| df_properties = df_properties[df_properties['months_since'] <= 12] | |
| # df_options = df_Atlanta.google_ola.values[:] | |
| df_options = st.session_state.get("df_options", [st.session_state['user_select_value']] + df_properties.google_ola.tolist()) | |
| # search_options = [""] + options | |
| selected_option = display_list_and_input() | |
| #### extra parameters | |
| # # Checkbox | |
| # col_1_1, col_1_2 = st.columns([1, 4]) | |
| # with col_1_1: | |
| # option1 = st.checkbox("Functionality problems", value=False) | |
| # with col_1_2: | |
| # if option1: | |
| # option1_text_input_value = st.text_input("Functionality problems description") | |
| # col_2_1, col_2_2 = st.columns([1, 4]) | |
| # with col_2_1: | |
| # option2 = st.checkbox("Special tax area", value=False) | |
| # with col_2_2: | |
| # if option2: | |
| # option1_text_input_value = st.text_input("Special tax area description") | |
| # # option2 = st.checkbox("Special tax area", value=False) | |
| # # special parameters free text | |
| # user_input = st.text_input("Enter special parameters of the building:") | |
| col_1_1, col_1_2 = st.columns([1, 2]) | |
| with col_1_1: | |
| st.write('Filter definition') | |
| min_property_size, max_property_size = st.slider('Property Size % Filter', min_value=-100, max_value=200, step = 10, | |
| value=(-30, 30)) | |
| months_back = st.slider('Lease Range Filter (Last X Months)', min_value=0, max_value=36, | |
| value=(12)) | |
| st.session_state['min_property_size_perc'] = min_property_size | |
| st.session_state['max_property_size_perc'] = max_property_size | |
| st.session_state['months_back'] = months_back | |
| if st.button("Submit"): | |
| if selected_option == "": | |
| st.write(":red[Please choose the property address]") | |
| else: | |
| st.session_state['user_select_value'] = selected_option | |
| st.session_state['execution_dates'] = 2014 | |
| prediction, property_lsf, market_val, submarket_val = get_market_submarket(df_properties, selected_option) | |
| st.session_state['market_val'] = market_val | |
| st.session_state['submarket_val'] = submarket_val | |
| st.session_state['property_lsf'] = property_lsf | |
| st.session_state['prediction'] = prediction | |
| st.switch_page("pages/market_rent_estimation.py") | |
| if __name__ == "__main__": | |
| main() |