Update app.py
Browse files
app.py
CHANGED
|
@@ -38,6 +38,7 @@ except Exception as e:
|
|
| 38 |
print(f"Eroare la încărcarea modelului: {str(e)}")
|
| 39 |
raise
|
| 40 |
|
|
|
|
| 41 |
@app.post("/predict")
|
| 42 |
async def predict(soil_data: SoilInput):
|
| 43 |
"""
|
|
@@ -49,10 +50,11 @@ async def predict(soil_data: SoilInput):
|
|
| 49 |
input_df = pd.DataFrame([input_data])
|
| 50 |
|
| 51 |
# Ne asigurăm că ordinea coloanelor este corectă
|
| 52 |
-
feature_order =
|
| 53 |
input_df = input_df[feature_order]
|
|
|
|
| 54 |
|
| 55 |
-
expected_features = model.feature_names_in_ # Extrage ordinea corectă din model
|
| 56 |
# input_df = input_df[expected_features] # Reordonează caracteristicile
|
| 57 |
|
| 58 |
# Facem predicția
|
|
|
|
| 38 |
print(f"Eroare la încărcarea modelului: {str(e)}")
|
| 39 |
raise
|
| 40 |
|
| 41 |
+
FEATURE_ORDER = ['cement_perecent', 'curing_period', 'compaction_rate']
|
| 42 |
@app.post("/predict")
|
| 43 |
async def predict(soil_data: SoilInput):
|
| 44 |
"""
|
|
|
|
| 50 |
input_df = pd.DataFrame([input_data])
|
| 51 |
|
| 52 |
# Ne asigurăm că ordinea coloanelor este corectă
|
| 53 |
+
feature_order = FEATURE_ORDER
|
| 54 |
input_df = input_df[feature_order]
|
| 55 |
+
# input_df = pd.DataFrame([soil_data.dict()])[FEATURE_ORDER]
|
| 56 |
|
| 57 |
+
# expected_features = model.feature_names_in_ # Extrage ordinea corectă din model
|
| 58 |
# input_df = input_df[expected_features] # Reordonează caracteristicile
|
| 59 |
|
| 60 |
# Facem predicția
|