Commit
·
0c62072
1
Parent(s):
7f15983
Update app.py
Browse files
app.py
CHANGED
@@ -89,26 +89,26 @@ input_features = [
|
|
89 |
|
90 |
def get_user_input():
|
91 |
input_dict = {}
|
92 |
-
for feat in input_features:
|
93 |
-
input_value = st.number_input(f"Enter {feat}", value=0.0, step=0.01)
|
94 |
-
input_dict[feat] = input_value
|
95 |
|
96 |
-
|
|
|
|
|
|
|
|
|
97 |
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
return
|
102 |
|
103 |
-
# Title
|
104 |
-
st.title("Wine Quality Prediction")
|
105 |
|
106 |
-
|
107 |
-
user_input = get_user_input()
|
108 |
|
109 |
-
#
|
110 |
-
|
|
|
|
|
111 |
|
112 |
-
# Display the
|
113 |
-
st.
|
114 |
-
st.write(prediction
|
|
|
89 |
|
90 |
def get_user_input():
|
91 |
input_dict = {}
|
|
|
|
|
|
|
92 |
|
93 |
+
|
94 |
+
with st.form(key='my_form'):
|
95 |
+
for feat in input_features:
|
96 |
+
input_value = st.number_input(f"Enter value for {feat}", value=0.0, step=0.01)
|
97 |
+
input_dict[feat] = input_value
|
98 |
|
99 |
+
|
100 |
+
submit_button = st.form_submit_button(label='Submit')
|
101 |
|
102 |
+
return pd.DataFrame([input_dict]), submit_button
|
103 |
|
|
|
|
|
104 |
|
105 |
+
user_input, submit_button = get_user_input()
|
|
|
106 |
|
107 |
+
# When the 'Submit' button is pressed, perform the prediction
|
108 |
+
if submit_button:
|
109 |
+
# Predict wine quality
|
110 |
+
prediction = pipe.predict(user_input)
|
111 |
|
112 |
+
# Display the prediction
|
113 |
+
st.header("Predicted Quality")
|
114 |
+
st.write(prediction)
|