tushargandhi77
commited on
Commit
•
26b69ef
1
Parent(s):
8520132
Upload 4 files
Browse files
app.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
|
5 |
+
pipe = pickle.load(open('pipe.pkl','rb'))
|
6 |
+
df = pickle.load(open('df.pkl','rb'))
|
7 |
+
|
8 |
+
st.title("Laptop Price Predictor")
|
9 |
+
|
10 |
+
company = st.selectbox('Brand',df['Company'].unique())
|
11 |
+
|
12 |
+
|
13 |
+
type = st.selectbox('Type',df['TypeName'].unique())
|
14 |
+
|
15 |
+
|
16 |
+
ram = st.selectbox('RAM(in GB)',[2,4,8,12,16,24,32,64])
|
17 |
+
|
18 |
+
|
19 |
+
weight = st.number_input('Weight of laptop')
|
20 |
+
|
21 |
+
|
22 |
+
touchscreen = st.selectbox('Touchscreen',['No','Yes'])
|
23 |
+
|
24 |
+
|
25 |
+
ips = st.selectbox('IPS',['No','Yes'])
|
26 |
+
|
27 |
+
|
28 |
+
screen_size = st.number_input('Screen Size')
|
29 |
+
|
30 |
+
|
31 |
+
resolution = st.selectbox('Screen Resolution',['1920x1080','1600x900','3840x2160','3200x1800','2560x1600','2560x1440','2304x1440','1366x768','2880x1800'])
|
32 |
+
|
33 |
+
|
34 |
+
cpu = st.selectbox('CPU',df['Cpu brand'].unique())
|
35 |
+
|
36 |
+
|
37 |
+
hdd = st.selectbox('HDD(in GB)',[0,128,256,512,1024,2048])
|
38 |
+
|
39 |
+
|
40 |
+
ssd = st.selectbox('SSD(in GB)',[0,8,128,256,512,1024,2048])
|
41 |
+
|
42 |
+
|
43 |
+
gpu = st.selectbox('GPU',df['Gpu Brand'].unique())
|
44 |
+
|
45 |
+
|
46 |
+
os = st.selectbox('Os',df['os'].unique())
|
47 |
+
|
48 |
+
|
49 |
+
if st.button('Predict Price'):
|
50 |
+
if touchscreen=='Yes':
|
51 |
+
touchscreen = 1
|
52 |
+
else:
|
53 |
+
touchscreen = 0
|
54 |
+
|
55 |
+
if ips =='Yes':
|
56 |
+
ips = 1
|
57 |
+
else:
|
58 |
+
ips = 0
|
59 |
+
|
60 |
+
X_res = int(resolution.split('x')[0])
|
61 |
+
Y_res = int(resolution.split('x')[1])
|
62 |
+
|
63 |
+
ppi = ((X_res**2) + (Y_res**2))**0.5/screen_size
|
64 |
+
|
65 |
+
query = np.array([company,type,ram,weight,touchscreen,ips,ppi,cpu,hdd,ssd,gpu,os])
|
66 |
+
|
67 |
+
query = query.reshape(1,12)
|
68 |
+
st.title("The Predicted Price: "+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:e4ccf217556b9beb6aa622b336a8c62569a1a7184f59dfad1aecdcad7430f56d
|
3 |
+
size 130202
|
pipe.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:413bf54949c7ad786724be1dbf61506a713145ac6df2b0cff444f9d9455db3d3
|
3 |
+
size 5470979
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit==1.28.2
|
2 |
+
numpy==1.26.1
|
3 |
+
pandas==2.1.2
|
4 |
+
scikit-learn==1.3.2
|