Spaces:
Runtime error
Runtime error
Shrikrishna
commited on
Commit
•
4f3d273
1
Parent(s):
8ddb9ac
Upload 4 files
Browse files
app.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
st.title("Laptop Price Predictor")
|
9 |
+
|
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.number_input('Screen Size')
|
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 |
+
ppi = None
|
48 |
+
if touchscreen == 'Yes':
|
49 |
+
touchscreen = 1
|
50 |
+
else:
|
51 |
+
touchscreen = 0
|
52 |
+
|
53 |
+
if ips == 'Yes':
|
54 |
+
ips = 1
|
55 |
+
else:
|
56 |
+
ips = 0
|
57 |
+
|
58 |
+
X_res = int(resolution.split('x')[0])
|
59 |
+
Y_res = int(resolution.split('x')[1])
|
60 |
+
ppi = ((X_res ** 2) + (Y_res ** 2)) ** 0.5 / screen_size
|
61 |
+
#st.title(ppi)
|
62 |
+
|
63 |
+
query = np.array([company, type, ram, weight, touchscreen, ips, ppi, cpu, hdd, ssd, gpu, os])
|
64 |
+
st.title(query)
|
65 |
+
query = query.reshape(1, 12)
|
66 |
+
st.title(len(query))
|
67 |
+
st.title(query)
|
68 |
+
st.title(np.exp(pipe.predict(query)))
|
df.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e85cf08c39e0f239e253b5f680c4e9b52e1e95595305f1dcff06f5bf260690b2
|
3 |
+
size 141801
|
pipe.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a84c3fc85016c9f29a842f27d90ca07f76925ceb0d7744f7a4afd8336a9c2035
|
3 |
+
size 4875623
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
sklearn
|