Update main.py
Browse files
main.py
CHANGED
@@ -37,13 +37,14 @@ def bot():
|
|
37 |
user_question = request.json.get("user_question")
|
38 |
print(json_table)
|
39 |
print(user_question)
|
40 |
-
|
|
|
41 |
#df['Profit'] = df['Profit'].apply(lambda x: "R{:.1f}".format((x)))
|
42 |
#df['Revenue'] = df['Revenue'].apply(lambda x: "R{:.1f}".format((x)))
|
43 |
-
|
44 |
|
45 |
-
|
46 |
-
|
47 |
return json_table
|
48 |
|
49 |
|
|
|
37 |
user_question = request.json.get("user_question")
|
38 |
print(json_table)
|
39 |
print(user_question)
|
40 |
+
data = eval(json_table)
|
41 |
+
df = pd.DataFrame(data)
|
42 |
#df['Profit'] = df['Profit'].apply(lambda x: "R{:.1f}".format((x)))
|
43 |
#df['Revenue'] = df['Revenue'].apply(lambda x: "R{:.1f}".format((x)))
|
44 |
+
llm = GooglePalm(temperature=0, google_api_key=os.environ['PALM'])
|
45 |
|
46 |
+
agent = create_pandas_dataframe_agent(llm, df, agent="structured_chat-zero-shot-react-description", verbose=True)
|
47 |
+
response = agent.run(user_question)
|
48 |
return json_table
|
49 |
|
50 |
|