rairo commited on
Commit
658e438
·
verified ·
1 Parent(s): e028530

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -4
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
- #df = pd.DataFrame(json_table)
 
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
- #llm = GooglePalm(temperature=0, google_api_key=os.environ['PALM'])
44
 
45
- #agent = create_pandas_dataframe_agent(llm, df, agent="structured_chat-zero-shot-react-description", verbose=True)
46
- #response = agent.run(user_question)
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