RMHalak commited on
Commit
a677df8
·
verified ·
1 Parent(s): b042d9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -6,7 +6,8 @@ from utils import create_new_features, normalize, init_new_pred
6
  with open('./trained_model.pkl', 'rb') as file:
7
  model = pickle.load(file)
8
 
9
- new_pred = st.text_area('Enter text')
 
10
 
11
  # Define min and max values from the dictionaries
12
  min_dict = {
@@ -86,10 +87,14 @@ if (bedrooms != min_dict['bedrooms'] or
86
  new_pred['yr_built'] = yr_built
87
  new_pred['yr_renovated'] = yr_renovated
88
  new_pred['city_Bellevue'] = 1
 
 
89
  new_pred = pd.DataFrame([new_pred])
90
-
91
  new_pred = create_new_features(new_pred)
92
  new_pred = normalize(new_pred)
93
-
 
94
  predicted_price = model.predict(new_pred)
95
- st.write(predicted_price[0][0])
 
 
 
6
  with open('./trained_model.pkl', 'rb') as file:
7
  model = pickle.load(file)
8
 
9
+ # Placeholder for displaying the predicted price at the top
10
+ price_placeholder = st.empty()
11
 
12
  # Define min and max values from the dictionaries
13
  min_dict = {
 
87
  new_pred['yr_built'] = yr_built
88
  new_pred['yr_renovated'] = yr_renovated
89
  new_pred['city_Bellevue'] = 1
90
+
91
+ # Process the prediction
92
  new_pred = pd.DataFrame([new_pred])
 
93
  new_pred = create_new_features(new_pred)
94
  new_pred = normalize(new_pred)
95
+
96
+ # Predict the price
97
  predicted_price = model.predict(new_pred)
98
+
99
+ # Display the predicted price at the top of the app
100
+ price_placeholder.write(f"Predicted Price: ${predicted_price[0][0]:,.2f}")