Illia56 commited on
Commit
0f45e38
·
1 Parent(s): 171cb08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -19,10 +19,11 @@ session.headers = {
19
  "Referer": "https://bard.google.com/",
20
  }
21
  session.cookies.set("__Secure-1PSID", os.getenv("_BARD_API_KEY"))
22
-
23
- # Add a selector in the sidebar using the dictionary's keys
24
- selected_language_name = st.sidebar.selectbox("Select Language", list(GOOGLE_LANGUAGES_TO_CODES.keys()))
25
-
 
26
  # Retrieve the corresponding language code from the dictionary
27
  selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
28
 
@@ -67,7 +68,7 @@ if prompt := st.chat_input("Ask Palm 2 anything..."):
67
  with st.chat_message("assistant", avatar='🌴'):
68
  st.markdown(response['content'])
69
 
70
- if response['code']:
71
  try:
72
  exec(response['code'])
73
  except Exception as e:
 
19
  "Referer": "https://bard.google.com/",
20
  }
21
  session.cookies.set("__Secure-1PSID", os.getenv("_BARD_API_KEY"))
22
+ with st.sidebar:
23
+ # Add a selector in the sidebar using the dictionary's keys
24
+ selected_language_name = st.sidebar.selectbox("Select Language", list(GOOGLE_LANGUAGES_TO_CODES.keys()))
25
+ code_interpreter = st.sidebar.checkbox("Code Interpreter", value=True)
26
+
27
  # Retrieve the corresponding language code from the dictionary
28
  selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
29
 
 
68
  with st.chat_message("assistant", avatar='🌴'):
69
  st.markdown(response['content'])
70
 
71
+ if response['code'] and code_interpreter:
72
  try:
73
  exec(response['code'])
74
  except Exception as e: