Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,7 @@ def find_similar_pattern(df, prediction, future_hours=24):
|
|
| 71 |
# Fonction pour générer une prédiction dynamique (Courbe verte)
|
| 72 |
def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
| 73 |
green_prediction = list(initial_prediction)
|
| 74 |
-
|
| 75 |
# Appliquer une mise à jour dynamique à la prédiction en utilisant des patterns passés
|
| 76 |
for i in range(future_hours):
|
| 77 |
last_price = df["price"].iloc[-1]
|
|
@@ -87,11 +87,12 @@ def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
|
| 87 |
green_prediction.append(ema + cycle_pred)
|
| 88 |
|
| 89 |
# Mise à jour du DataFrame avec pd.concat() au lieu de append()
|
| 90 |
-
future_timestamp = df.index[-1] + timedelta(hours=
|
| 91 |
new_row = pd.DataFrame([[future_timestamp, green_prediction[-1]]], columns=['timestamp', 'price'])
|
| 92 |
df = pd.concat([df, new_row], ignore_index=False)
|
| 93 |
|
| 94 |
-
|
|
|
|
| 95 |
|
| 96 |
# Configuration des dates
|
| 97 |
end_time = datetime.now()
|
|
|
|
| 71 |
# Fonction pour générer une prédiction dynamique (Courbe verte)
|
| 72 |
def generate_dynamic_prediction(df, initial_prediction, future_hours=24):
|
| 73 |
green_prediction = list(initial_prediction)
|
| 74 |
+
|
| 75 |
# Appliquer une mise à jour dynamique à la prédiction en utilisant des patterns passés
|
| 76 |
for i in range(future_hours):
|
| 77 |
last_price = df["price"].iloc[-1]
|
|
|
|
| 87 |
green_prediction.append(ema + cycle_pred)
|
| 88 |
|
| 89 |
# Mise à jour du DataFrame avec pd.concat() au lieu de append()
|
| 90 |
+
future_timestamp = df.index[-1] + timedelta(hours=1) # Utilisation de timedelta correctement
|
| 91 |
new_row = pd.DataFrame([[future_timestamp, green_prediction[-1]]], columns=['timestamp', 'price'])
|
| 92 |
df = pd.concat([df, new_row], ignore_index=False)
|
| 93 |
|
| 94 |
+
future_timestamps = pd.to_datetime(df.index[-future_hours:]) # Actualisation des timestamps futurs
|
| 95 |
+
return green_prediction, future_timestamps
|
| 96 |
|
| 97 |
# Configuration des dates
|
| 98 |
end_time = datetime.now()
|