Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -616,40 +616,38 @@ def timegpt_anom():
|
|
616 |
# Convert the Plotly figure to a Matplotlib figure if needed
|
617 |
# Note: You may need to handle this conversion depending on your specific use case
|
618 |
# For now, this example assumes that you are using a Matplotlib figure
|
619 |
-
fig = nixtla_client.plot(df,
|
620 |
st.pyplot(fig)
|
621 |
elif plot_type == "Plotly":
|
622 |
# Plotly figure directly
|
623 |
-
fig = nixtla_client.plot(df,
|
624 |
st.plotly_chart(fig)
|
625 |
|
626 |
end_time = time.time() # End timing
|
627 |
time_taken = end_time - start_time
|
628 |
st.success(f"Time taken for TimeGPT forecast: {time_taken:.2f} seconds")
|
629 |
|
630 |
-
|
631 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
st.write(df_grid)
|
641 |
-
# grid_table = AgGrid(
|
642 |
-
# df_grid,
|
643 |
-
# theme="alpine",
|
644 |
-
# )
|
645 |
-
|
646 |
-
with tab_forecast:
|
647 |
-
df_grid = forecast_df
|
648 |
-
st.write(df_grid)
|
649 |
-
# grid_table = AgGrid(
|
650 |
-
# df_grid,
|
651 |
-
# theme="alpine",
|
652 |
-
# )
|
653 |
|
654 |
|
655 |
|
|
|
616 |
# Convert the Plotly figure to a Matplotlib figure if needed
|
617 |
# Note: You may need to handle this conversion depending on your specific use case
|
618 |
# For now, this example assumes that you are using a Matplotlib figure
|
619 |
+
fig = nixtla_client.plot(df, anom_df, level=[90], engine='matplotlib')
|
620 |
st.pyplot(fig)
|
621 |
elif plot_type == "Plotly":
|
622 |
# Plotly figure directly
|
623 |
+
fig = nixtla_client.plot(df, anom_df, level=[90], engine='plotly')
|
624 |
st.plotly_chart(fig)
|
625 |
|
626 |
end_time = time.time() # End timing
|
627 |
time_taken = end_time - start_time
|
628 |
st.success(f"Time taken for TimeGPT forecast: {time_taken:.2f} seconds")
|
629 |
|
630 |
+
|
631 |
+
st.markdown('You can download Input and Forecast Data below')
|
632 |
+
tab_insample, tab_forecast = st.tabs(
|
633 |
+
["Input data", "Forecast"]
|
634 |
+
)
|
635 |
+
|
636 |
+
with tab_insample:
|
637 |
+
df_grid = df.drop(columns="unique_id")
|
638 |
+
st.write(df_grid)
|
639 |
+
# grid_table = AgGrid(
|
640 |
+
# df_grid,
|
641 |
+
# theme="alpine",
|
642 |
+
# )
|
643 |
|
644 |
+
with tab_forecast:
|
645 |
+
df_grid = anom_df
|
646 |
+
st.write(df_grid)
|
647 |
+
# grid_table = AgGrid(
|
648 |
+
# df_grid,
|
649 |
+
# theme="alpine",
|
650 |
+
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
651 |
|
652 |
|
653 |
|