mikeee commited on
Commit
2f81e02
·
1 Parent(s): 23a122d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import os
 
 
2
  from random import randint
3
  import streamlit as st
4
  from types import SimpleNamespace
@@ -177,12 +179,13 @@ if ask:
177
  else:
178
  # api_key_ = os.environ["OPENAI_API_KEY"]
179
  api_key_ = api_key
180
-
 
181
  if not api_key_:
182
  st.write(f"**{BOOK_NAME}:** got {dice}, no luck, try again?")
183
  st.stop()
184
  else:
185
- os.environ["OPENAI_API_KEY"] = api_key_
186
  # if ns.counter: # this does not work
187
  if 'key' in st.session_state:
188
  msg = "Just one sec"
 
1
  import os
2
+
3
+ import openai
4
  from random import randint
5
  import streamlit as st
6
  from types import SimpleNamespace
 
179
  else:
180
  # api_key_ = os.environ["OPENAI_API_KEY"]
181
  api_key_ = api_key
182
+
183
+ openai.api_key = api_key_
184
  if not api_key_:
185
  st.write(f"**{BOOK_NAME}:** got {dice}, no luck, try again?")
186
  st.stop()
187
  else:
188
+ # os.environ["OPENAI_API_KEY"] = api_key_
189
  # if ns.counter: # this does not work
190
  if 'key' in st.session_state:
191
  msg = "Just one sec"