Spaces:
Build error
Build error
Commit
·
d13c92f
1
Parent(s):
f38f95f
changing the get plot route to return bytes of the image
Browse files
app.py
CHANGED
|
@@ -30,7 +30,9 @@ def get_plot(plt_key):
|
|
| 30 |
filepath = os.path.join(UPLOAD_FOLDER, filename)
|
| 31 |
|
| 32 |
if os.path.isfile(filepath):
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
else:
|
| 35 |
return "Plot not found", 404
|
| 36 |
|
|
|
|
| 30 |
filepath = os.path.join(UPLOAD_FOLDER, filename)
|
| 31 |
|
| 32 |
if os.path.isfile(filepath):
|
| 33 |
+
with open(filepath, "rb") as file:
|
| 34 |
+
plot_bytes = file.read()
|
| 35 |
+
return plot_bytes, 200, {"Content-Type": "image/png"}
|
| 36 |
else:
|
| 37 |
return "Plot not found", 404
|
| 38 |
|