Spaces:
Sleeping
Sleeping
feat: set MLflow tracking URI and update model reference in prediction endpoint
Browse files
app.py
CHANGED
|
@@ -4,6 +4,10 @@ import mlflow.pyfunc
|
|
| 4 |
import pandas as pd
|
| 5 |
import config
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
description = """
|
| 8 |
Bienvenue sur l'API de Getaround pour prédire le prix journalier de location d'une voiture en fonction de son année d'expérience!
|
| 9 |
|
|
@@ -114,7 +118,7 @@ async def predict(predictionFeatures: RentalFeatures):
|
|
| 114 |
car_caracteristic = pd.DataFrame({"Car": pf})
|
| 115 |
|
| 116 |
# Log model from mlflow
|
| 117 |
-
logged_model = "getaround-price-prediction-model-linear-regression" # REPLACE WITH YOUR OWN RUN ID
|
| 118 |
|
| 119 |
# Load model as a PyFuncModel.
|
| 120 |
loaded_model = mlflow.pyfunc.load_model(logged_model)
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
import config
|
| 6 |
|
| 7 |
+
# 1) URL du Space HF qui héberge MLflow (tracking server)
|
| 8 |
+
SPACE_URL = "https://pradelf-getaround-api.hf.space" # <-- remplace ici
|
| 9 |
+
mlflow.set_tracking_uri(SPACE_URL) # ou via env MLFLOW_TRACKING_URI
|
| 10 |
+
|
| 11 |
description = """
|
| 12 |
Bienvenue sur l'API de Getaround pour prédire le prix journalier de location d'une voiture en fonction de son année d'expérience!
|
| 13 |
|
|
|
|
| 118 |
car_caracteristic = pd.DataFrame({"Car": pf})
|
| 119 |
|
| 120 |
# Log model from mlflow
|
| 121 |
+
logged_model = "models:/getaround-price-prediction-model-linear-regression/9" # REPLACE WITH YOUR OWN RUN ID
|
| 122 |
|
| 123 |
# Load model as a PyFuncModel.
|
| 124 |
loaded_model = mlflow.pyfunc.load_model(logged_model)
|