jonathanjordan21 commited on
Commit
1c1ce3e
·
verified ·
1 Parent(s): a00224c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -48,7 +48,13 @@ async def run_code(code: Code):
48
  # img_buffer.seek(0) # Reset buffer position
49
 
50
  file_path = "graph.pdf"
51
- fig.save_fig(file_path)
 
 
 
 
 
 
52
  plt.close()
53
  # plt.savefig(file_path)
54
  # plt.close()
 
48
  # img_buffer.seek(0) # Reset buffer position
49
 
50
  file_path = "graph.pdf"
51
+
52
+ if code.code == "plt.subplots(":
53
+
54
+ exec(code.code + "\nfig.savefig(file_path)")
55
+ else:
56
+ exec(code.code + "\nplt.savefig(file_path)")
57
+
58
  plt.close()
59
  # plt.savefig(file_path)
60
  # plt.close()