1import joblib
2from huggingface_hub import hf_hub_download
3
4# Chargement des artefacts du modèle
5model_path = hf_hub_download(
6 repo_id="a126OPS/carburant_price_predict",
7 filename="modele_carburant.joblib",
8)
9model_data = joblib.load(model_path)
10pipeline = model_data["pipeline"]
11
12print(type(pipeline).__name__)
1{
2 "data": ["75", "Diesel", 7]
3}
1const response = await fetch("https://<ton-space>.hf.space/api/predict", {
2 method: "POST",
3 headers: {
4 "Content-Type": "application/json",
5 },
6 body: JSON.stringify({
7 data: ["75", "Diesel", 7],
8 }),
9});
10
11const payload = await response.json();
12const result = payload.data[0];
13
14if (!result.ok) {
15 console.error(result.error);
16} else {
17 console.log(result.prediction.prix_predit_eur_l);
18 console.log(result.tendance.conseil);
19}
Développé par
a126OPS
🔗 Modèle :
carburant_price_predict
🔗 Démo interactive et API :
carburant_predict