Fixed plot not loading issue (ensured correct file save path)
Browse files28 unmodified lines293031323334353637383928 unmodified linesif grid:plt.grid()plot_filename = os.path.abspath("high_res_plot.png")plt.savefig(plot_filename, dpi=300)plt.close()return plot_filename, plot_filenameexcept Exception as e:return f"Error: {e}", None28 unmodified lines293031323334353637383940414243444528 unmodified linesif grid:plt.grid()# Save the plot correctly and return an absolute pathplot_filename = "high_res_plot.png"abs_path = os.path.abspath(plot_filename) # Convert to absolute pathplt.savefig(abs_path, dpi=300)plt.close()# Ensure the file exists before returningif os.path.exists(abs_path):return abs_path, abs_pathelse:return "Error: Plot file was not created", Noneexcept Exception as e:return f"Error: {e}", None
app.py+9-3