jonathanjordan21 commited on
Commit
f435b5e
1 Parent(s): b0b485a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -75,10 +75,18 @@ if prompt := st.chat_input("Ask me anything.."):
75
 
76
  # full_response = st.session_state.chain.invoke(prompt).split("\n<|")[0]
77
  full_response = st.session_state.chain.invoke({"question":prompt, "memory":st.session_state.memory, "df_example":format_df(st.session_state.df.head(4))}).split("\n<|")[0]
78
-
79
 
 
 
 
 
 
 
 
 
80
  with st.chat_message("assistant"):
81
  st.markdown(full_response)
 
82
 
83
  # Display assistant response in chat message container
84
  # with st.chat_message("assistant"):
 
75
 
76
  # full_response = st.session_state.chain.invoke(prompt).split("\n<|")[0]
77
  full_response = st.session_state.chain.invoke({"question":prompt, "memory":st.session_state.memory, "df_example":format_df(st.session_state.df.head(4))}).split("\n<|")[0]
 
78
 
79
+ print(len(full_response))
80
+
81
+ try :
82
+ exec(full_response)
83
+ full_response = "Here is the python code: \n\n```python"+ full_response +"\n```\n\nGenerated Response: \n\n"+ str(response)
84
+ except:
85
+ pass
86
+
87
  with st.chat_message("assistant"):
88
  st.markdown(full_response)
89
+
90
 
91
  # Display assistant response in chat message container
92
  # with st.chat_message("assistant"):