Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -29,8 +29,11 @@ async def get_image_for_text(email,query,file: UploadFile = File(...)):
|
|
29 |
with open(email+".csv", "wb") as file_object:
|
30 |
file_object.write(file.file.read())
|
31 |
llm = OpenAI(api_token=secret,save_charts=True)
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
29 |
with open(email+".csv", "wb") as file_object:
|
30 |
file_object.write(file.file.read())
|
31 |
llm = OpenAI(api_token=secret,save_charts=True)
|
32 |
+
try:
|
33 |
+
df = pd.read_csv(email+".csv")
|
34 |
+
sdf = SmartDataframe(df, config={"llm": llm})
|
35 |
+
sdf.chat(query)
|
36 |
+
image_path = "exports/charts/temp_chart.png" # Replace with your image's path
|
37 |
+
return FileResponse(image_path)
|
38 |
+
except:
|
39 |
+
return "try again"
|