Spaces:
Sleeping
Sleeping
| class Summarizer: | |
| def summarize(self, df, fc, query): | |
| last_actual = df.iloc[-1].to_dict() | |
| forecast_tail = fc.tail(5)[["ds", "yhat"]].to_string(index=False) | |
| summary = ( | |
| f"π **User asked:** {query}\n\n" | |
| f"π **Last actual data:**\n{last_actual}\n\n" | |
| f"π **Forecast for next steps:**\n{forecast_tail}\n\n" | |
| f"π Summary: Based on the recent trends, the forecast suggests continued fluctuation or growth depending on recent values." | |
| ) | |
| return summary | |