Download utils/visualization.py from Fred808/Insta-AI: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/spaces/Fred808/Insta-AI/resolve/main/utils/visualization.py
- Command line
-
hf download hf://spaces/Fred808/Insta-AI/utils/visualization.py
-
curl -L -o visualization.py https://huggingface.co/spaces/Fred808/Insta-AI/resolve/main/utils/visualization.py
759 Bytes
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| def plot_engagement_heatmap(engagement_by_hour): | |
| """Plot engagement heatmap by time of day.""" | |
| plt.figure(figsize=(10, 6)) | |
| sns.heatmap(engagement_by_hour.pivot_table(index='hour', values='engagement_rate'), annot=True, cmap='YlGnBu') | |
| plt.title('Engagement Heatmap by Time of Day') | |
| plt.xlabel('Engagement Rate') | |
| plt.ylabel('Hour of Day') | |
| plt.show() | |
| def plot_engagement_over_time(engagement_summary): | |
| """Plot engagement rate over time.""" | |
| plt.figure(figsize=(10, 6)) | |
| plt.plot(engagement_summary['posting_time'], engagement_summary['engagement_rate']) | |
| plt.title('Engagement Rate Over Time') | |
| plt.xlabel('Time') | |
| plt.ylabel('Engagement Rate') | |
| plt.show() |