Update app.py
Browse files
app.py
CHANGED
|
@@ -106,8 +106,6 @@ with st.sidebar:
|
|
| 106 |
|
| 107 |
if api_key:
|
| 108 |
os.environ["OPENAI_API_KEY"] = api_key
|
| 109 |
-
else:
|
| 110 |
-
os.environ["OPENAI_API_KEY"] = None
|
| 111 |
|
| 112 |
st.info("This isn't saved π")
|
| 113 |
|
|
@@ -126,10 +124,12 @@ ask = st.button("Ask")
|
|
| 126 |
|
| 127 |
if ask:
|
| 128 |
|
| 129 |
-
if
|
| 130 |
output = "Whoops looks like you forgot your API key buddy"
|
| 131 |
-
|
| 132 |
output = get_answer(question=user_input)
|
|
|
|
|
|
|
| 133 |
|
| 134 |
st.session_state.past.append(user_input)
|
| 135 |
st.session_state.generated.append(output)
|
|
|
|
| 106 |
|
| 107 |
if api_key:
|
| 108 |
os.environ["OPENAI_API_KEY"] = api_key
|
|
|
|
|
|
|
| 109 |
|
| 110 |
st.info("This isn't saved π")
|
| 111 |
|
|
|
|
| 124 |
|
| 125 |
if ask:
|
| 126 |
|
| 127 |
+
if api_key is None:
|
| 128 |
output = "Whoops looks like you forgot your API key buddy"
|
| 129 |
+
elif:
|
| 130 |
output = get_answer(question=user_input)
|
| 131 |
+
else:
|
| 132 |
+
output = "What's going on? That's not the right API key"
|
| 133 |
|
| 134 |
st.session_state.past.append(user_input)
|
| 135 |
st.session_state.generated.append(output)
|