Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -90,9 +90,16 @@ def predict_future_prices(
|
|
90 |
predicted_prices = scaler.inverse_transform(
|
91 |
np.array(predicted).reshape(-1, 1)
|
92 |
).flatten()
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
prediction_df = pd.DataFrame(
|
97 |
{"Date": future_dates, "Predicted Price": predicted_prices}
|
98 |
)
|
@@ -657,16 +664,14 @@ if st.session_state.show_overlay:
|
|
657 |
margin-right: 15px;
|
658 |
margin-left:3px;
|
659 |
font-family: "Times New Roman " !important; /* Font */
|
660 |
-
|
661 |
font-size: 14px;
|
662 |
border: 1px solid rgba(255, 255, 255, 0.2);
|
663 |
margin-bottom:30px;
|
664 |
-
|
665 |
}
|
666 |
|
667 |
/* Inner scrolling container */
|
668 |
.glass-container {
|
669 |
-
max-height:
|
670 |
overflow-y: auto;
|
671 |
padding: 16px 24px 16px 16px; /* right padding gives room for scrollbar */
|
672 |
}
|
|
|
90 |
predicted_prices = scaler.inverse_transform(
|
91 |
np.array(predicted).reshape(-1, 1)
|
92 |
).flatten()
|
93 |
+
last_date = df["Date"].max()
|
94 |
+
today = pd.Timestamp.today().normalize()
|
95 |
+
|
96 |
+
if last_date >= today:
|
97 |
+
start_date = last_date + pd.Timedelta(days=1)
|
98 |
+
else:
|
99 |
+
start_date = today # fallback to today if data is old
|
100 |
+
|
101 |
+
future_dates = pd.date_range(start=start_date, periods=n_future_days)
|
102 |
+
|
103 |
prediction_df = pd.DataFrame(
|
104 |
{"Date": future_dates, "Predicted Price": predicted_prices}
|
105 |
)
|
|
|
664 |
margin-right: 15px;
|
665 |
margin-left:3px;
|
666 |
font-family: "Times New Roman " !important; /* Font */
|
|
|
667 |
font-size: 14px;
|
668 |
border: 1px solid rgba(255, 255, 255, 0.2);
|
669 |
margin-bottom:30px;
|
|
|
670 |
}
|
671 |
|
672 |
/* Inner scrolling container */
|
673 |
.glass-container {
|
674 |
+
max-height: 400px;
|
675 |
overflow-y: auto;
|
676 |
padding: 16px 24px 16px 16px; /* right padding gives room for scrollbar */
|
677 |
}
|