Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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]
|
| 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 |
-
|
| 64 |
output = gr.Textbox(label="Prediction")
|
| 65 |
|
| 66 |
submit_button = gr.Button("Predict")
|
| 67 |
-
submit_button.click(predict, inputs=
|
| 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 |
+
|