-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
32 lines (25 loc) · 1.12 KB
/
app.py
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
# prompt: using streamlit above model make web applicaton
import streamlit as st
import pandas as pd
import joblib
# Load the saved model
model = joblib.load('best_house_price_model.pkl')
# Define the features
features = ['id', 'Date', 'No of bedrooms', 'No of bathrooms', 'living area',
'lot area', 'No of floors', 'waterfront present', 'No of views',
'house condition', 'house grade', 'house area(excluding basement)',
'Area of the basement', 'Built Year', 'Renovation Year', 'Postal Code',
'Lattitude', 'Longitude', 'living_area_renov', 'lot_area_renov',
'No of schools nearby', 'Distance from the airport']
# Create the Streamlit app
st.title("House Price Prediction")
# Create input fields for each feature
user_input = {}
for feature in features:
user_input[feature] = st.number_input(f"Enter value for {feature}:")
# Create a DataFrame from user input
input_df = pd.DataFrame([user_input])
# Make prediction when the user clicks the button
if st.button("Predict"):
prediction = model.predict(input_df)
st.success(f"Predicted Price: ${prediction[0]:,.2f}")