File size: 4,955 Bytes
90e6536
 
45c5ade
90e6536
15dadca
 
2d02181
6db34ca
4d8038a
6db34ca
4d8038a
6db34ca
4d8038a
6db34ca
 
 
 
 
 
 
 
 
 
 
4d8038a
 
 
90e6536
 
98b5d26
90e6536
 
61bb87c
 
c3a6003
61bb87c
 
 
 
b56858b
61bb87c
 
 
 
 
 
 
 
 
 
 
 
2d02181
90e6536
53cc59e
90e6536
2d02181
 
 
 
 
8c9a2f0
2d02181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3f54623
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
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=500,max_value=2000)
        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=15)
        Has_4G = st.selectbox("Has_4G",options=unique_four_g)
        memory = st.slider("memory",min_value=500,max_value=2000)
        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],
                                               "bluetooth": [bluetooth],
                                               "clock_speed": [clock_speed],
                                               "dual_sim": [dual_sim],
                                               "Front_Camera_mega_pixels": [Front_Camera_mega_pixels],
                                               "Has_4G": [Has_4G],
                                               "memory": [memory],
                                               "Mobile_Depth": [Mobile_Depth],
                                               "Weight": [Weight],
                                               "Number_of_cores_of_processor": [ Number_of_cores_of_processor],
                                               "Primary_Camera_mega_pixels": [Primary_Camera_mega_pixels],
                                               "Pixel_Resolution_Height": [Pixel_Resolution_Height],
                                               "Pixel_Resolution_Width": [Pixel_Resolution_Width],
                                               "ram": [ram],
                                               "Screen_Height_of_mobile_in_cm": [Screen_Height_of_mobile_in_cm],
                                               "Screen_Width_of_mobile_in_cm": [Screen_Width_of_mobile_in_cm],
                                               "longest_time_that_a_single_battery_charge_will_last_when_you_are": [longest_time_that_a_single_battery_charge_will_last_when_you_are],
                                               "Has_3G": [Has_3G],
                                               "Has_touch_screen": [Has_touch_screen],
                                               "Has_wifi": [Has_wifi]}))
            #result = '>50k' if result[0] == 1 else '<50k'
            st.success("Your predicted Mobile prices is " +result)
if __name__ == "__main__":
    main()
                       # Show prediction

# Run main()