luisotorres commited on
Commit
0c62072
·
1 Parent(s): 7f15983

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
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
- user_input = pd.DataFrame([input_dict])
 
 
 
 
97
 
98
- # Debug: print out the user input
99
- st.write(user_input)
100
 
101
- return user_input
102
 
103
- # Title
104
- st.title("Wine Quality Prediction")
105
 
106
- # Get user inputs
107
- user_input = get_user_input()
108
 
109
- # Make predictions
110
- prediction = pipe.predict(user_input)
 
 
111
 
112
- # Display the result
113
- st.subheader("Prediction")
114
- st.write(prediction[0])
 
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)