Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,8 @@ import gradio as gr
|
|
2 |
import pandas as pd
|
3 |
import joblib
|
4 |
import numpy as np
|
5 |
-
from models.neural_network.inference import load_model_and_preprocessor
|
6 |
|
7 |
# Load the pre-trained model
|
8 |
-
nn_model, nn_preprocessor = load_model_and_preprocessor('saved_models/nn_model.keras',
|
9 |
-
'saved_models/nn_preprocessor.pkl')
|
10 |
xgboost_model = joblib.load('saved_models/xgboost_model.joblib')
|
11 |
|
12 |
# Load the unique aircraft data
|
@@ -44,10 +41,8 @@ def predict_fuel_burn(model_name, origin, destination, seats, distance):
|
|
44 |
df = pd.DataFrame(data)
|
45 |
|
46 |
# Make the prediction
|
47 |
-
fuel_burn_prediction_nn = nn_model.predict(nn_preprocessor.transform(df))[0]
|
48 |
fuel_burn_prediction_xgboost = xgboost_model.predict(df)
|
49 |
-
|
50 |
-
return f"Neural Network: {fuel_burn_prediction_nn[0]:.2f} kg, XGBoost: {fuel_burn_prediction_xgboost[0]:.2f} kg"
|
51 |
|
52 |
|
53 |
def update_fields(model_name):
|
|
|
2 |
import pandas as pd
|
3 |
import joblib
|
4 |
import numpy as np
|
|
|
5 |
|
6 |
# Load the pre-trained model
|
|
|
|
|
7 |
xgboost_model = joblib.load('saved_models/xgboost_model.joblib')
|
8 |
|
9 |
# Load the unique aircraft data
|
|
|
41 |
df = pd.DataFrame(data)
|
42 |
|
43 |
# Make the prediction
|
|
|
44 |
fuel_burn_prediction_xgboost = xgboost_model.predict(df)
|
45 |
+
return f"{fuel_burn_prediction_xgboost[0]:.2f} kg"
|
|
|
46 |
|
47 |
|
48 |
def update_fields(model_name):
|