gauravlochab commited on
Commit
2532f44
·
1 Parent(s): aca6ce1

modified app.py for data memory issue

Browse files
Files changed (1) hide show
  1. app.py +6 -21
app.py CHANGED
@@ -1387,14 +1387,8 @@ def create_combined_roi_time_series_graph(df):
1387
  graph_file = "optimus_roi_graph.html"
1388
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
1389
 
1390
- # Also save as image for compatibility
1391
- img_file = "optimus_roi_graph.png"
1392
- try:
1393
- fig.write_image(img_file)
1394
- logger.info(f"ROI graph saved to {graph_file} and {img_file}")
1395
- except Exception as e:
1396
- logger.error(f"Error saving ROI image: {e}")
1397
- logger.info(f"ROI graph saved to {graph_file} only")
1398
 
1399
  # Return the figure object for direct use in Gradio
1400
  return fig
@@ -1636,11 +1630,8 @@ def create_time_series_graph_per_agent(df):
1636
  graph_file = "optimus_apr_per_agent_graph.html"
1637
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
1638
 
1639
- # Also save as image for compatibility
1640
- img_file = "optimus_apr_per_agent_graph.png"
1641
- fig.write_image(img_file)
1642
-
1643
- logger.info(f"Per-agent graph saved to {graph_file} and {img_file}")
1644
 
1645
  # Return the figure object for direct use in Gradio
1646
  return fig
@@ -2184,14 +2175,8 @@ def create_combined_time_series_graph(df):
2184
  graph_file = "optimus_apr_combined_graph.html"
2185
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
2186
 
2187
- # Also save as image for compatibility
2188
- img_file = "optimus_apr_combined_graph.png"
2189
- try:
2190
- fig.write_image(img_file)
2191
- logger.info(f"Combined graph saved to {graph_file} and {img_file}")
2192
- except Exception as e:
2193
- logger.error(f"Error saving image: {e}")
2194
- logger.info(f"Combined graph saved to {graph_file} only")
2195
 
2196
  # Return the figure object for direct use in Gradio
2197
  return fig
 
1387
  graph_file = "optimus_roi_graph.html"
1388
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
1389
 
1390
+ # Skip PNG generation to avoid Kaleido/Chrome dependency issues in HF Spaces
1391
+ logger.info(f"ROI graph saved to {graph_file} (PNG generation skipped for HF Spaces compatibility)")
 
 
 
 
 
 
1392
 
1393
  # Return the figure object for direct use in Gradio
1394
  return fig
 
1630
  graph_file = "optimus_apr_per_agent_graph.html"
1631
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
1632
 
1633
+ # Skip PNG generation to avoid Kaleido/Chrome dependency issues in HF Spaces
1634
+ logger.info(f"Per-agent graph saved to {graph_file} (PNG generation skipped for HF Spaces compatibility)")
 
 
 
1635
 
1636
  # Return the figure object for direct use in Gradio
1637
  return fig
 
2175
  graph_file = "optimus_apr_combined_graph.html"
2176
  fig.write_html(graph_file, include_plotlyjs='cdn', full_html=False)
2177
 
2178
+ # Skip PNG generation to avoid Kaleido/Chrome dependency issues in HF Spaces
2179
+ logger.info(f"Combined graph saved to {graph_file} (PNG generation skipped for HF Spaces compatibility)")
 
 
 
 
 
 
2180
 
2181
  # Return the figure object for direct use in Gradio
2182
  return fig