Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,11 @@ from langchain import PromptTemplate
|
|
14 |
from loguru import logger
|
15 |
|
16 |
# ns = SimpleNamespace(counter=0)
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
st.set_page_config(page_title="Talk2Book", page_icon="📖")
|
19 |
|
@@ -166,7 +171,8 @@ if ask:
|
|
166 |
dice = randint(1, 6)
|
167 |
logger.info(f" dice: {dice}")
|
168 |
if dice == 6:
|
169 |
-
api_key_ = os.environ["OPENAI_API_KEY"]
|
|
|
170 |
st.write(f"**{BOOK_NAME}:** got {dice}, lucky you!")
|
171 |
|
172 |
openai.api_key = api_key_
|
|
|
14 |
from loguru import logger
|
15 |
|
16 |
# ns = SimpleNamespace(counter=0)
|
17 |
+
open_api_key = os.getenv('OPENAI_API_KEY', '')
|
18 |
+
logger.debug(f" open_api_key: {open_api_key} ")
|
19 |
+
|
20 |
+
# delete os .environ
|
21 |
+
delete os.environ['OPENAI_API_KEY']
|
22 |
|
23 |
st.set_page_config(page_title="Talk2Book", page_icon="📖")
|
24 |
|
|
|
171 |
dice = randint(1, 6)
|
172 |
logger.info(f" dice: {dice}")
|
173 |
if dice == 6:
|
174 |
+
# api_key_ = os.environ["OPENAI_API_KEY"]
|
175 |
+
api_key_ = openai_api_key
|
176 |
st.write(f"**{BOOK_NAME}:** got {dice}, lucky you!")
|
177 |
|
178 |
openai.api_key = api_key_
|