Update app.py
Browse files
app.py
CHANGED
@@ -30,36 +30,50 @@ st.image("https://study.com/academy/lesson/star-formation-main-sequence-dwarf-gi
|
|
30 |
def main():
|
31 |
st.text('For comparing all models of ML It can be used for prediction')
|
32 |
with st.form("questionaire"):
|
33 |
-
|
34 |
L = st.slider('Relative Luminosity',min_value=0,max_value=1000000)
|
35 |
R = st.slider('Relative Radius',min_value=0,max_value=2000)
|
36 |
A_M = st.slider('Absolute Magnitude',min_value=0,max_value=25)
|
37 |
Color = st.selectbox("General Color of Spectrum",options=unique_CL)
|
38 |
Spectral_Class = st.selectbox("Spectral_Class",options=unique_SC)
|
39 |
clicked = st.form_submit_button("Predict type")
|
40 |
-
|
41 |
-
result=model.predict(pd.DataFrame({"Temperature": [
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
if __name__=="__main__":
|
65 |
main()
|
|
|
30 |
def main():
|
31 |
st.text('For comparing all models of ML It can be used for prediction')
|
32 |
with st.form("questionaire"):
|
33 |
+
K = st.slider('Temperature',min_value=1900,max_value=40000)
|
34 |
L = st.slider('Relative Luminosity',min_value=0,max_value=1000000)
|
35 |
R = st.slider('Relative Radius',min_value=0,max_value=2000)
|
36 |
A_M = st.slider('Absolute Magnitude',min_value=0,max_value=25)
|
37 |
Color = st.selectbox("General Color of Spectrum",options=unique_CL)
|
38 |
Spectral_Class = st.selectbox("Spectral_Class",options=unique_SC)
|
39 |
clicked = st.form_submit_button("Predict type")
|
40 |
+
if clicked:
|
41 |
+
result = model.predict(pd.DataFrame({"Temperature(K)": [K],
|
42 |
+
"Relative Luminosity(Watts)": [L],
|
43 |
+
"Relative Radius(m)": [R],
|
44 |
+
"Absolute Magnitude": [A_M],
|
45 |
+
"Color": [Color],
|
46 |
+
"Spectral_Class": [Spectral_Class]})
|
47 |
+
)
|
48 |
+
|
49 |
+
prob = model.predict_prob(pd.DataFrame({"Temperature(K)": [K],
|
50 |
+
"Relative Luminosity(Watts)": [L],
|
51 |
+
"Relative Radius(m)": [R],
|
52 |
+
"Absolute Magnitude": [A_M],
|
53 |
+
"Color": [Color],
|
54 |
+
"Spectral_Class": [Spectral_Class]})
|
55 |
+
)
|
56 |
+
|
57 |
+
prob = pd.DataFrame(prob, columns = ["Red Dwarf",'Brown Dwarf','White Dwarf','Main Sequence','Super Giants','Hyper Giants']).reset_index(drop=True)
|
58 |
+
prob['Type'] = 'Probability'
|
59 |
+
prob = prob.set_index('Type')
|
60 |
+
|
61 |
+
st.write(prob)
|
62 |
+
|
63 |
+
if result[0] == '0':
|
64 |
+
st.text('Red Dwarf')
|
65 |
+
elif result[0] == '1':
|
66 |
+
st.text('Brown Dwarf')
|
67 |
+
elif result[0] == '2':
|
68 |
+
st.text('White Dwarf')
|
69 |
+
elif result[0] == '3':
|
70 |
+
st.text('Main Sequence')
|
71 |
+
elif result[0] == '4':
|
72 |
+
st.text('Super Giants')
|
73 |
+
else:
|
74 |
+
st.text('Hyper Giants')
|
75 |
+
|
76 |
+
st.write("My star type is...", result[0])
|
77 |
|
78 |
if __name__=="__main__":
|
79 |
main()
|