prahalya commited on
Commit
25aba85
Β·
verified Β·
1 Parent(s): 84c0d08

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +31 -0
  2. elite27.pkl +3 -0
  3. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+ import streamlit as st
3
+ import numpy as np
4
+
5
+ # βœ… Load the trained model in binary mode ('rb')
6
+ model_path = r"C:/Users/DELL/Downloads/3746233-Week_1/elite27.pkl"
7
+
8
+ try:
9
+ with open(model_path, "rb") as f:
10
+ model = pickle.load(f)
11
+ st.success("βœ… Model loaded successfully!")
12
+ except Exception as e:
13
+ st.error(f"❌ Error loading model: {e}")
14
+ st.stop() # Stop execution if model can't be loaded
15
+
16
+ # βœ… Input fields
17
+ st.title("🏑 House Price Prediction App")
18
+ square_feet = st.number_input("Enter Square Feet:", min_value=500, max_value=10000)
19
+ bedrooms = st.number_input("Enter Number of Bedrooms:", min_value=1, max_value=10)
20
+ bathrooms = st.number_input("Enter Number of Bathrooms:", min_value=1, max_value=10)
21
+ neighborhood = st.selectbox("Select Neighborhood", [0, 1, 2], format_func=lambda x: ["Rural", "Semi Urban", "Urban"][x])
22
+ year_built = st.number_input("Enter Year Built:", min_value=1900, max_value=2025)
23
+
24
+ # βœ… Predict price
25
+ if st.button("Predict Price πŸ’°"):
26
+ try:
27
+ user_data = np.array([[square_feet, bedrooms, bathrooms, neighborhood, year_built]], dtype=float)
28
+ prediction = model.predict(user_data)
29
+ st.success(f"🏠 Estimated House Price: ${prediction[0]:,.2f}")
30
+ except Exception as e:
31
+ st.error(f"❌ Prediction error: {e}")
elite27.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:895e1c0f50832213cac2303d43b8da918cd412d82a52aa5b98b96c570531146f
3
+ size 633
requirements.txt ADDED
File without changes