Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -64,11 +64,10 @@ async def get_image_for_text(email,query,file: UploadFile = File(...)):
|
|
64 |
sdf = SmartDataframe(df, config={"llm": llm})
|
65 |
sdf.chat(query)
|
66 |
|
67 |
-
code_to_exec = ""
|
68 |
-
import matplotlib.pyplot as plt
|
69 |
-
import seaborn as sns\n"""
|
70 |
code_to_exec = code_to_exec + sdf.last_code_generated.replace("dfs[0]","dfs")
|
71 |
-
code_to_exec = code_to_exec.replace("
|
|
|
72 |
print(code_to_exec)
|
73 |
local_vars = {'dfs': df}
|
74 |
exec(code_to_exec, globals(), local_vars)
|
@@ -77,6 +76,7 @@ async def get_image_for_text(email,query,file: UploadFile = File(...)):
|
|
77 |
print(email+file_name+".png",df.head())
|
78 |
|
79 |
return FileResponse(email+file_name+".png")
|
|
|
80 |
image_path = "exports/charts/temp_chart.png" # Replace with your image's path
|
81 |
base64str = convert_image_to_base64(image_path)
|
82 |
|
|
|
64 |
sdf = SmartDataframe(df, config={"llm": llm})
|
65 |
sdf.chat(query)
|
66 |
|
67 |
+
code_to_exec = "import matplotlib.pyplot as plt\nimport seaborn as sns\n"
|
|
|
|
|
68 |
code_to_exec = code_to_exec + sdf.last_code_generated.replace("dfs[0]","dfs")
|
69 |
+
code_to_exec = code_to_exec.replace("exports/charts/temp_chart.png",email+file_name+".png")
|
70 |
+
|
71 |
print(code_to_exec)
|
72 |
local_vars = {'dfs': df}
|
73 |
exec(code_to_exec, globals(), local_vars)
|
|
|
76 |
print(email+file_name+".png",df.head())
|
77 |
|
78 |
return FileResponse(email+file_name+".png")
|
79 |
+
|
80 |
image_path = "exports/charts/temp_chart.png" # Replace with your image's path
|
81 |
base64str = convert_image_to_base64(image_path)
|
82 |
|