Spaces:
Runtime error
Runtime error
Commit
·
f6880ae
1
Parent(s):
2ae7b31
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,10 @@ from statsforecast import StatsForecast
|
|
| 7 |
from statsforecast.models import seasonal_naive, auto_arima
|
| 8 |
from utils import calc_seasonality
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
st.title('Forecasting time series')
|
| 11 |
|
| 12 |
uploaded_file = st.file_uploader("Choose a CSV file", accept_multiple_files=False)
|
|
@@ -48,6 +52,15 @@ if uploaded_file is not None:
|
|
| 48 |
|
| 49 |
st.write(forecasts)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
fig_forecast = go.Figure([
|
| 52 |
go.Scatter(
|
| 53 |
name=series,
|
|
|
|
| 7 |
from statsforecast.models import seasonal_naive, auto_arima
|
| 8 |
from utils import calc_seasonality
|
| 9 |
|
| 10 |
+
@st.cache
|
| 11 |
+
def convert_df(df):
|
| 12 |
+
return df.to_csv().encode('utf-8')
|
| 13 |
+
|
| 14 |
st.title('Forecasting time series')
|
| 15 |
|
| 16 |
uploaded_file = st.file_uploader("Choose a CSV file", accept_multiple_files=False)
|
|
|
|
| 52 |
|
| 53 |
st.write(forecasts)
|
| 54 |
|
| 55 |
+
csv = convert_df(forecasts)
|
| 56 |
+
|
| 57 |
+
st.download_button(
|
| 58 |
+
label="Download data as CSV",
|
| 59 |
+
data=csv,
|
| 60 |
+
file_name='forecast.csv',
|
| 61 |
+
mime='text/csv',
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
fig_forecast = go.Figure([
|
| 65 |
go.Scatter(
|
| 66 |
name=series,
|