Spaces:
Runtime error
Runtime error
add search log
Browse files- app.py +14 -0
- data/search.csv +1 -0
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import streamlit as st
|
|
| 9 |
import seaborn as sns
|
| 10 |
from streamlit_folium import st_folium
|
| 11 |
import matplotlib.pyplot as plt
|
|
|
|
| 12 |
from utils import *
|
| 13 |
|
| 14 |
########## Title for the Web App ##########
|
|
@@ -111,6 +112,19 @@ with st.form("inputs"):
|
|
| 111 |
elif input_propertyType == 'HDB':
|
| 112 |
propertyType_HDB = 1
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
latlong_geo['district'] = postal_final.loc[postal_final['2dpostal'] == input_postal[:2], 'district'].item() # all districts are covered in train set
|
| 115 |
latlong_geo['storey'] = input_storey
|
| 116 |
latlong_geo['age_asof_transaction'] = input_age_asof_transaction
|
|
|
|
| 9 |
import seaborn as sns
|
| 10 |
from streamlit_folium import st_folium
|
| 11 |
import matplotlib.pyplot as plt
|
| 12 |
+
from datetime import datetime
|
| 13 |
from utils import *
|
| 14 |
|
| 15 |
########## Title for the Web App ##########
|
|
|
|
| 112 |
elif input_propertyType == 'HDB':
|
| 113 |
propertyType_HDB = 1
|
| 114 |
|
| 115 |
+
# log searches
|
| 116 |
+
search_master = pd.read_csv('data/search.csv')
|
| 117 |
+
search_df = pd.DataFrame({'datetime': datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
| 118 |
+
'postal': input_postal,
|
| 119 |
+
'storey': input_storey,
|
| 120 |
+
'age': input_age_asof_transaction,
|
| 121 |
+
'floor_area_sqft': input_floor_area_sqft,
|
| 122 |
+
'property_type': input_propertyType
|
| 123 |
+
})
|
| 124 |
+
search_final = pd.concat([search_master, search_df])
|
| 125 |
+
search_final.to_csv('data/search.csv', index=False)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
latlong_geo['district'] = postal_final.loc[postal_final['2dpostal'] == input_postal[:2], 'district'].item() # all districts are covered in train set
|
| 129 |
latlong_geo['storey'] = input_storey
|
| 130 |
latlong_geo['age_asof_transaction'] = input_age_asof_transaction
|
data/search.csv
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
datetime,postal,storey,age,floor_area_sqft,property_type
|