Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,10 +47,13 @@ async def run_code(code: Code):
|
|
47 |
exec(code.code)
|
48 |
# img_buffer.seek(0) # Reset buffer position
|
49 |
|
50 |
-
file_path = "graph.
|
51 |
-
|
52 |
plt.close()
|
|
|
|
|
53 |
|
54 |
# Return image as response
|
55 |
# return Response(content=img_buffer.getvalue(), media_type="image/png")
|
56 |
-
return FileResponse(file_path, media_type="image/png")
|
|
|
|
47 |
exec(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()
|
55 |
|
56 |
# Return image as response
|
57 |
# return Response(content=img_buffer.getvalue(), media_type="image/png")
|
58 |
+
# return FileResponse(file_path, media_type="image/png")
|
59 |
+
return FileResponse(file_path, media_type="application/pdf", filename="graph.pdf")
|