File size: 2,026 Bytes
dd0dc20
 
 
 
a3984fd
 
dd0dc20
 
95694b6
dd0dc20
 
fcbebab
 
04ba023
dd0dc20
b6fdf3a
 
 
 
bc6147d
4ae5228
dd0dc20
dc6a3fb
51a0c47
 
 
fcbebab
aff42d3
 
 
51a0c47
43d72a1
611444e
43d72a1
611444e
43d72a1
611444e
43d72a1
 
 
611444e
43d72a1
611444e
51a0c47
bc6147d
43d72a1
dd0dc20
 
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
import joblib
import pandas as pd
import streamlit as st

model = joblib.load('model (3).joblib')
unique_values = joblib.load('unique_values (3).joblib')

unique_CL =  unique_values["Color"]
unique_SC =  unique_values["Spectral_Class"]

def main():
    st.title("My star type")
    st.image("https://img.freepik.com/free-vector/different-types-stars-dark-space_1308-37762.jpg")
    st.text("example -> \nK = 27739, L = 849420 , R = 1252, A_M = -7.59 , Color = Blue ,Spectral_Class = B\n -> Type = Hyper Giants")
    with st.form("questionaire"):
         K = st.number_input('Temperature')
         L = st.number_input('Relative Luminosity')
         R = st.number_input('Relative Radius')
         AM = st.number_input('Absolute Magnitude')
         Color = st.selectbox("General Color of Spectrum",options=unique_CL)
         Spectral_Class = st.selectbox("Spectral_Class",options=unique_SC)
         clicked = st.form_submit_button("Predict type")
         if clicked:
            result = model.predict(pd.DataFrame({"Temperature(K)": [K],
                                                 "Relative Luminosity(Watts)": [L],
                                                 "Relative Radius(m)": [R],
                                                 "Absolute Magnitude": [AM],
                                                 "Color": [Color],
                                                 "Spectral_Class": [Spectral_Class]
                                                 })
            )
            if result[0] == 0:
                result = "Red Dwarf"
            elif result[0] == 1:
                result = "Brown Dwarf"
            elif result[0] == 2:
                result = "White Dwarf"
            elif result[0] == 3:
                result = "Main Sequence"
            elif result[0] == 4:
                result = "Super Giants"
            else:
                result = "Hyper Giants"
                
            st.write(f"star type... {result}")
           
if __name__=="__main__":
    main()