Upload 5 files
Browse files- LaptopPricepred_Updated_02_02_2025.ipynb +0 -0
- app.py +67 -0
- df.pkl +3 -0
- pipe.pkl +3 -0
- requirements.txt +4 -2
LaptopPricepred_Updated_02_02_2025.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pickle
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# import the model
|
| 6 |
+
pipe = pickle.load(open('pipe.pkl','rb'))
|
| 7 |
+
df = pickle.load(open('df.pkl','rb'))
|
| 8 |
+
|
| 9 |
+
st.title("Laptop Price Prediction Application")
|
| 10 |
+
|
| 11 |
+
# brand
|
| 12 |
+
company = st.selectbox('Brand',df['Company'].unique())
|
| 13 |
+
|
| 14 |
+
# type of laptop
|
| 15 |
+
type = st.selectbox('Type',df['TypeName'].unique())
|
| 16 |
+
|
| 17 |
+
# Ram
|
| 18 |
+
ram = st.selectbox('RAM(in GB)',[2,4,6,8,12,16,24,32,64])
|
| 19 |
+
|
| 20 |
+
# weight
|
| 21 |
+
weight = st.number_input('Weight of the Laptop')
|
| 22 |
+
|
| 23 |
+
# Touchscreen
|
| 24 |
+
touchscreen = st.selectbox('Touchscreen',['No','Yes'])
|
| 25 |
+
|
| 26 |
+
# IPS
|
| 27 |
+
ips = st.selectbox('IPS',['No','Yes'])
|
| 28 |
+
|
| 29 |
+
# screen size
|
| 30 |
+
screen_size = st.slider('Scrensize in inches', 10.0, 18.0, 13.0)
|
| 31 |
+
|
| 32 |
+
# resolution
|
| 33 |
+
resolution = st.selectbox('Screen Resolution',['1920x1080','1366x768','1600x900','3840x2160','3200x1800','2880x1800','2560x1600','2560x1440','2304x1440'])
|
| 34 |
+
|
| 35 |
+
#cpu
|
| 36 |
+
cpu = st.selectbox('CPU',df['Cpu brand'].unique())
|
| 37 |
+
|
| 38 |
+
hdd = st.selectbox('HDD(in GB)',[0,128,256,512,1024,2048])
|
| 39 |
+
|
| 40 |
+
ssd = st.selectbox('SSD(in GB)',[0,8,128,256,512,1024])
|
| 41 |
+
|
| 42 |
+
gpu = st.selectbox('GPU',df['Gpu brand'].unique())
|
| 43 |
+
|
| 44 |
+
os = st.selectbox('OS',df['os'].unique())
|
| 45 |
+
|
| 46 |
+
if st.button('Predict Price'):
|
| 47 |
+
# query
|
| 48 |
+
ppi = None
|
| 49 |
+
if touchscreen == 'Yes':
|
| 50 |
+
touchscreen = 1
|
| 51 |
+
else:
|
| 52 |
+
touchscreen = 0
|
| 53 |
+
|
| 54 |
+
if ips == 'Yes':
|
| 55 |
+
ips = 1
|
| 56 |
+
else:
|
| 57 |
+
ips = 0
|
| 58 |
+
|
| 59 |
+
X_res = int(resolution.split('x')[0])
|
| 60 |
+
Y_res = int(resolution.split('x')[1])
|
| 61 |
+
ppi = ((X_res**2) + (Y_res**2))**0.5/screen_size
|
| 62 |
+
query = np.array([company,type,ram,weight,touchscreen,ips,ppi,cpu,hdd,ssd,gpu,os],dtype=object)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
query = query.reshape(1,12)
|
| 67 |
+
st.title("The predicted price of this configuration is " + str(int(np.exp(pipe.predict(query)[0]))))
|
df.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7b822393b42a282b32a5a22e22e1c2ea576791ee03d9052b83128ea7b9762eca
|
| 3 |
+
size 125029
|
pipe.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:708fbfd0491c7a2fda7d868da324ccb7973169d6c78fcd4ac0c61cd8b660ec80
|
| 3 |
+
size 19229072
|
requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
pandas
|
| 3 |
-
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
numpy
|
| 3 |
pandas
|
| 4 |
+
scikit-learn==1.3.2
|
| 5 |
+
xgboost
|