Spaces:
Sleeping
Sleeping
Download src/summarizer.py from ashantharosary/Forecast_Agent: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/spaces/ashantharosary/Forecast_Agent/resolve/main/src/summarizer.py
- Command line
-
hf download hf://spaces/ashantharosary/Forecast_Agent/src/summarizer.py
-
curl -L -o summarizer.py https://huggingface.co/spaces/ashantharosary/Forecast_Agent/resolve/main/src/summarizer.py
562 Bytes
| 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 | |