Update app.py
Browse files
app.py
CHANGED
|
@@ -167,12 +167,14 @@ if ask:
|
|
| 167 |
if not api_key:
|
| 168 |
st.write(f"**{BOOK_NAME}:** Whoops looks like you forgot your API key buddy. We throw a dice to decide wether you can ask one question for free.")
|
| 169 |
# stop with a prob = 0.9
|
|
|
|
| 170 |
if random() > 1/6:
|
| 171 |
-
|
|
|
|
| 172 |
else: # use space secret[OPENAI_API_KEY/envion,
|
| 173 |
-
|
| 174 |
|
| 175 |
-
if not
|
| 176 |
st.write(f"**{BOOK_NAME}:** no luck, try again?")
|
| 177 |
st.stop()
|
| 178 |
else:
|
|
|
|
| 167 |
if not api_key:
|
| 168 |
st.write(f"**{BOOK_NAME}:** Whoops looks like you forgot your API key buddy. We throw a dice to decide wether you can ask one question for free.")
|
| 169 |
# stop with a prob = 0.9
|
| 170 |
+
|
| 171 |
if random() > 1/6:
|
| 172 |
+
api_key_ = api_key
|
| 173 |
+
# st.stop()
|
| 174 |
else: # use space secret[OPENAI_API_KEY/envion,
|
| 175 |
+
api_key_ = os.environ["OPENAI_API_KEY"]
|
| 176 |
|
| 177 |
+
if not api_key_:
|
| 178 |
st.write(f"**{BOOK_NAME}:** no luck, try again?")
|
| 179 |
st.stop()
|
| 180 |
else:
|