Benjamin Consolvo
commited on
Commit
·
f2dc4d3
1
Parent(s):
1bf3cbd
api secret testing
Browse files
app.py
CHANGED
@@ -16,17 +16,18 @@ st.title("Intel® AI for Enterprise Inference \n Chatbot")
|
|
16 |
# Extract the keys (model names) from the JSON data
|
17 |
model_names = list(endpoint_data.keys())
|
18 |
|
19 |
-
st.session_state.api_key = st.secrets["openai_apikey2"]
|
20 |
|
21 |
with st.sidebar:
|
22 |
modelname = st.selectbox("Select a LLM model (Running on Intel® Gaudi®) ", model_names)
|
23 |
st.write(f"You selected: {modelname}")
|
24 |
st.button("Start New Chat", on_click=clear_chat)
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
if
|
29 |
-
st.
|
|
|
|
|
30 |
|
31 |
# Check if the API key is provided
|
32 |
if "api_key" not in st.session_state or not st.session_state.api_key:
|
|
|
16 |
# Extract the keys (model names) from the JSON data
|
17 |
model_names = list(endpoint_data.keys())
|
18 |
|
|
|
19 |
|
20 |
with st.sidebar:
|
21 |
modelname = st.selectbox("Select a LLM model (Running on Intel® Gaudi®) ", model_names)
|
22 |
st.write(f"You selected: {modelname}")
|
23 |
st.button("Start New Chat", on_click=clear_chat)
|
24 |
+
try:
|
25 |
+
st.session_state.api_key = st.secrets["openai_apikey"]
|
26 |
+
except KeyError:
|
27 |
+
# Add a text input for the API key if not in session state
|
28 |
+
api_key = st.text_input("Enter your API Key", type="password")
|
29 |
+
if api_key:
|
30 |
+
st.session_state.api_key = api_key
|
31 |
|
32 |
# Check if the API key is provided
|
33 |
if "api_key" not in st.session_state or not st.session_state.api_key:
|