Spaces:
Sleeping
Sleeping
Sync App files
Browse files
app.py
CHANGED
|
@@ -153,6 +153,12 @@ class StockPredictor:
|
|
| 153 |
last_values["month"] = date.month
|
| 154 |
last_values["day"] = date.day
|
| 155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
# Ensure input features are in the correct format
|
| 157 |
prediction_input = pd.DataFrame([last_values], columns=features)
|
| 158 |
prediction = model.predict(prediction_input)[0]
|
|
|
|
| 153 |
last_values["month"] = date.month
|
| 154 |
last_values["day"] = date.day
|
| 155 |
|
| 156 |
+
# Update the lag features
|
| 157 |
+
if len(last_5_close) >= 5:
|
| 158 |
+
last_values["lag_5"] = last_5_close[-5]
|
| 159 |
+
if len(last_10_close) >= 10:
|
| 160 |
+
last_values["lag_10"] = last_10_close[-10]
|
| 161 |
+
|
| 162 |
# Ensure input features are in the correct format
|
| 163 |
prediction_input = pd.DataFrame([last_values], columns=features)
|
| 164 |
prediction = model.predict(prediction_input)[0]
|