danielritchie commited on
Commit
16b217f
1 Parent(s): 857bde5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -20,7 +20,7 @@ df.fillna(df.select_dtypes(include=['number']).mean(), inplace=True)
20
 
21
  # Handle missing categorical values with mode
22
  for col in df.select_dtypes(include=['object']).columns:
23
- df[col].fillna(df[col].mode()[0], inplace=True)
24
 
25
  # One-hot encoding for categorical variables
26
  categorical_cols = [
@@ -60,10 +60,11 @@ with gr.Blocks() as demo:
60
  row_number_input.change(explore_data, inputs=[row_number_input], outputs=[data_output])
61
 
62
  gr.Markdown("## Make a Prediction")
63
- input_data = {col: gr.Number(label=col) for col in X.columns} # Adjust based on features
64
  output = gr.Textbox(label="Prediction")
65
 
66
  submit_button = gr.Button("Predict")
67
- submit_button.click(predict, inputs=[input_data], outputs=[output])
68
 
69
  demo.launch()
 
 
20
 
21
  # Handle missing categorical values with mode
22
  for col in df.select_dtypes(include=['object']).columns:
23
+ df[col] = df[col].fillna(df[col].mode()[0])
24
 
25
  # One-hot encoding for categorical variables
26
  categorical_cols = [
 
60
  row_number_input.change(explore_data, inputs=[row_number_input], outputs=[data_output])
61
 
62
  gr.Markdown("## Make a Prediction")
63
+ input_components = [gr.Number(label=col) for col in X.columns] # Unpack the input components
64
  output = gr.Textbox(label="Prediction")
65
 
66
  submit_button = gr.Button("Predict")
67
+ submit_button.click(predict, inputs=input_components, outputs=[output]) # Pass as separate inputs
68
 
69
  demo.launch()
70
+