Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,11 +72,11 @@ def find_similar_pattern(df, prediction, future_hours=24):
|
|
| 72 |
|
| 73 |
# Fonction pour générer une prédiction dynamique (Courbe verte)
|
| 74 |
def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
| 75 |
-
green_prediction =
|
| 76 |
-
|
| 77 |
-
# Première prédiction
|
| 78 |
-
green_prediction.extend(initial_prediction)
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
# Boucle pour ajuster la prédiction à chaque étape
|
| 81 |
for i in range(future_hours // 5): # Prédiction par segments de 5 heures
|
| 82 |
start_idx = i * 5
|
|
@@ -88,6 +88,9 @@ def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
|
| 88 |
# Ajouter le pattern similaire à la prédiction
|
| 89 |
green_prediction.extend(similar_pattern)
|
| 90 |
|
|
|
|
|
|
|
|
|
|
| 91 |
return green_prediction
|
| 92 |
|
| 93 |
# Configuration des dates
|
|
|
|
| 72 |
|
| 73 |
# Fonction pour générer une prédiction dynamique (Courbe verte)
|
| 74 |
def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
| 75 |
+
green_prediction = initial_prediction # Commencer avec la prédiction initiale
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
# Calculer la longueur de la série future
|
| 78 |
+
future_timestamps = [df.index[-1] + timedelta(hours=i) for i in range(1, future_hours + 1)]
|
| 79 |
+
|
| 80 |
# Boucle pour ajuster la prédiction à chaque étape
|
| 81 |
for i in range(future_hours // 5): # Prédiction par segments de 5 heures
|
| 82 |
start_idx = i * 5
|
|
|
|
| 88 |
# Ajouter le pattern similaire à la prédiction
|
| 89 |
green_prediction.extend(similar_pattern)
|
| 90 |
|
| 91 |
+
# Réduire green_prediction pour qu'elle ait la même longueur que future_timestamps
|
| 92 |
+
green_prediction = green_prediction[:len(future_timestamps)]
|
| 93 |
+
|
| 94 |
return green_prediction
|
| 95 |
|
| 96 |
# Configuration des dates
|