Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,8 @@ 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.
|
|
|
26 |
|
27 |
# Retrieve the corresponding language code from the dictionary
|
28 |
selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
|
@@ -42,7 +43,7 @@ st.write(DESCRIPTION)
|
|
42 |
def predict(message):
|
43 |
with st.status("Requesting Palm-2🌴..."):
|
44 |
st.write("Requesting API...")
|
45 |
-
response = bard.get_answer(message if not code_interpreter else message +
|
46 |
st.write("Done...")
|
47 |
|
48 |
st.write("Checking images...")
|
|
|
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.toggle("Code Interpreter", value=False)
|
26 |
+
system_prompt = st.sidebar.text_input("System prompt for code interpreter", value = "Rule 1: If a user requests a code snippet, provide only one that can run in a Streamlit app without requiring additional libraries.")
|
27 |
|
28 |
# Retrieve the corresponding language code from the dictionary
|
29 |
selected_language_code = GOOGLE_LANGUAGES_TO_CODES[selected_language_name]
|
|
|
43 |
def predict(message):
|
44 |
with st.status("Requesting Palm-2🌴..."):
|
45 |
st.write("Requesting API...")
|
46 |
+
response = bard.get_answer(message if not code_interpreter else message + system_prompt)
|
47 |
st.write("Done...")
|
48 |
|
49 |
st.write("Checking images...")
|