Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|