Update main.py
Browse files
main.py
CHANGED
@@ -19,11 +19,13 @@ def load_model():
|
|
19 |
return num_imputer, scaler, model
|
20 |
|
21 |
def preprocess_input_data(input_data, num_imputer, scaler):
|
22 |
-
input_data_df = pd.DataFrame(input_data)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
|
28 |
@app.get("/")
|
29 |
def read_root():
|
|
|
19 |
return num_imputer, scaler, model
|
20 |
|
21 |
def preprocess_input_data(input_data, num_imputer, scaler):
|
22 |
+
input_data_df = pd.DataFrame([input_data], index=[0]) # Add index [0] to the DataFrame
|
23 |
+
input_data_scaled = scaler.transform(input_data_df)
|
24 |
+
input_data_scaled = pd.DataFrame(input_data_scaled, columns=input_data_df.columns)
|
25 |
+
input_data_imputed = num_imputer.transform(input_data_scaled)
|
26 |
+
|
27 |
+
return input_data_imputed
|
28 |
+
|
29 |
|
30 |
@app.get("/")
|
31 |
def read_root():
|