Update main.py
Browse files
main.py
CHANGED
@@ -65,15 +65,13 @@ async def get_image_for_text(email,query,file: UploadFile = File(...)):
|
|
65 |
|
66 |
print(code_to_exec)
|
67 |
local_vars = {'dfs': df}
|
68 |
-
|
69 |
try:
|
70 |
-
|
71 |
print(email+file_name+".png",df.head())
|
72 |
|
73 |
-
return FileResponse(email+file_name+".png")
|
74 |
-
|
75 |
-
image_path = "exports/charts/temp_chart.png" # Replace with your image's path
|
76 |
-
base64str = convert_image_to_base64(image_path)
|
77 |
|
78 |
return {"id":str(uuid1),"image":base64str}
|
79 |
except Exception as e:
|
|
|
65 |
|
66 |
print(code_to_exec)
|
67 |
local_vars = {'dfs': df}
|
68 |
+
|
69 |
try:
|
70 |
+
exec(code_to_exec, globals(), local_vars)
|
71 |
print(email+file_name+".png",df.head())
|
72 |
|
73 |
+
#return FileResponse(email+file_name+".png")
|
74 |
+
base64str = convert_image_to_base64(email+file_name+".png")
|
|
|
|
|
75 |
|
76 |
return {"id":str(uuid1),"image":base64str}
|
77 |
except Exception as e:
|