File size: 1,071 Bytes
c134c47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
import streamlit as st
import pickle
import numpy as np

# import the model
pipe = pickle.load(open('pipe.pkl','rb'))
df = pickle.load(open('df.pkl','rb'))

st.title("Smartphone Price Predictor")
# Main page content
st.image('mobile.png', use_column_width=True)

# brand
Company = st.selectbox('Brand',df['Brand'].unique())

# year
Released_Year = st.selectbox('Released Year',df['Released Year'].unique())

# OS
Operating_System = st.selectbox('OS',df['OS'].unique())

# size
Display = st.number_input('Display (Inches)')

# Camera
Camera = st.number_input('Camera (MP)')

# resolution
Camera_Resolution= st.selectbox('Camera Resolution',df['Camera Resolution'].unique())

# Ram
Ram = st.number_input('Ram (GB)')

# Battery
Battery = st.number_input('Battery (mAh)')



if st.button('Predict Price'):
    query = np.array([Company, Released_Year, Operating_System, Display, Camera, Camera_Resolution, Ram, Battery])
    query = query.reshape(1, -1)
    st.title("The predicted price of this configuration mobile is " + str(int(np.exp(pipe.predict(query)[0]))) + ' TK.')