File size: 4,889 Bytes
90e6536
 
45c5ade
90e6536
15dadca
 
2d02181
6db34ca
4d8038a
6db34ca
4d8038a
6db34ca
4d8038a
6db34ca
 
 
 
 
 
 
 
 
 
 
4d8038a
 
 
90e6536
 
98b5d26
90e6536
 
a5a59aa
61bb87c
c3a6003
61bb87c
a5a59aa
61bb87c
a5a59aa
b56858b
61bb87c
 
 
 
 
 
 
 
 
 
 
 
2d02181
90e6536
53cc59e
90e6536
2d02181
3b2f43d
2d02181
 
3b2f43d
 
 
 
 
 
 
 
 
2d02181
3b2f43d
 
 
 
 
 
1162387
78468d1
f45c1eb
78468d1
f45c1eb
78468d1
 
c15322c
15dadca
 
 
90e6536
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import joblib
import pandas as pd
import streamlit as st

model = joblib.load('model.joblib')
unique_values = joblib.load('unique_values.joblib')
 
#unique_battery_power = unique_values["battery_power"]
unique_blue = unique_values["blue"]
#unique_clock_speed = unique_values["clock_speed"]
unique_dual_sim = unique_values["dual_sim"]
#unique_fc = unique_values["fc"]
unique_four_g = unique_values["four_g"]
#unique_int_memory = unique_values["int_memory"]
#unique_m_dep = unique_values["m_dep"]
#unique_mobile_wt = unique_values["mobile_wt"]
#unique_n_cores = unique_values["n_cores"]
#unique_pc = unique_values["pc"]
#unique_px_height = unique_values["px_height"]
#unique_px_width = unique_values["px_width"]
#unique_px_ram = unique_values["ram"]
#unique_px_sc_h = unique_values["sc_h"]
#unique_sc_w = unique_values["sc_w"]
#unique_talk_time = unique_values["talk_time"]
unique_three_g = unique_values["three_g"]
unique_touch_screen = unique_values["touch_screen"]
unique_wifi = unique_values["wifi"]

def main():
    st.title("Mobile prices")

    with st.form("questionaire"):
        battery_power = st.slider("battery_power",min_value=501,max_value=1998)
        bluetooth = st.selectbox("bluetooth",options=unique_blue)
        clock_speed = st.slider("clock_speed",min_value=0,max_value=3)
        dual_sim = st.selectbox("dual_sim",options=unique_dual_sim)
        Front_Camera_mega_pixels = st.slider("Front_Camera_mega_pixels",min_value=0,max_value=19)
        Has_4G = st.selectbox("Has_4G",options=unique_four_g)
        memory = st.slider("memory",min_value=2,max_value=64)
        Mobile_Depth = st.slider("Mobile_Depth",min_value=0,max_value=1)
        Weight = st.slider("Weight",min_value=80,max_value=200)
        Number_of_cores_of_processor = st.slider("Number_of_cores_of_processor",min_value=1,max_value=8)
        Primary_Camera_mega_pixels = st.slider("Primary_Camera_mega_pixels",min_value=0,max_value=20)
        Pixel_Resolution_Height = st.slider("Pixel_Resolution_Height",min_value=0,max_value=1960)
        Pixel_Resolution_Width = st.slider("Pixel_Resolution_Width",min_value=500,max_value=1998)
        ram = st.slider("ram",min_value=256,max_value=3998)
        Screen_Height_of_mobile_in_cm = st.slider("Screen_Height_of_mobile_in_cm",min_value=5,max_value=19)
        Screen_Width_of_mobile_in_cm = st.slider("Screen_Width_of_mobile_in_cm",min_value=0,max_value=18)
        longest_time_that_a_single_battery_charge_will_last_when_you_are = st.slider("longest_time_that_a_single_battery_charge_will_last_when_you_are",min_value=2,max_value=20)
        Has_3G = st.selectbox("Has_3G",options=unique_three_g)
        Has_touch_screen = st.selectbox("Has_touch_screen",options=unique_touch_screen)
        Has_wifi = st.selectbox("Has_wifi",options=unique_wifi)
     
        # clicked==True only when the button is clicked
        clicked = st.form_submit_button("Mobile prices")
        if clicked:
            result=model.predict(pd.DataFrame({"battery_power": [battery_power],
                                               "blue": [bluetooth],
                                               "clock_speed": [clock_speed],
                                               "dual_sim": [dual_sim],
                                               "fc": [Front_Camera_mega_pixels],
                                               "four_g": [Has_4G],
                                               "int_memory": [memory],
                                               "m_dep": [Mobile_Depth],
                                               "mobile_wt": [Weight],
                                               "n_cores": [ Number_of_cores_of_processor],
                                               "pc": [Primary_Camera_mega_pixels],
                                               "px_height": [Pixel_Resolution_Height],
                                               "px_width": [Pixel_Resolution_Width],
                                               "ram": [ram],
                                               "sc_h": [Screen_Height_of_mobile_in_cm],
                                               "sc_w": [Screen_Width_of_mobile_in_cm],
                                               "talk_time": [longest_time_that_a_single_battery_charge_will_last_when_you_are],
                                               "three_g": [Has_3G],
                                               "touch_screen": [Has_touch_screen],
                                               "wifi": [Has_wifi]}))
            if result[0] == 0:
              result = 'low cost' 
            elif result[0] == 1:
              result = 'high cost' 
            else: 
              result = 'very high cost'
              
            st.success('Your predicted Mobile prices is '+result)
if __name__ == "__main__":
    main()
                       # Show prediction

# Run main()