eaglelandsonce commited on
Commit
8ab1139
·
1 Parent(s): 3d2e8c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -16,7 +16,9 @@ from bs4 import BeautifulSoup
16
  from collections import deque
17
  from audio_recorder_streamlit import audio_recorder
18
 
19
- openai.api_key = os.getenv('OPENAI_KEY')
 
 
20
  st.set_page_config(page_title="GPT Streamlit Document Reasoner",layout="wide")
21
 
22
  menu = ["htm", "txt", "xlsx", "csv", "md", "py"] #619
@@ -147,6 +149,14 @@ def read_file_content(file,max_length):
147
  return ""
148
 
149
  def main():
 
 
 
 
 
 
 
 
150
  user_prompt = st.text_area("Enter prompts, instructions & questions:", '', height=100)
151
 
152
  collength, colupload = st.columns([2,3]) # adjust the ratio as needed
 
16
  from collections import deque
17
  from audio_recorder_streamlit import audio_recorder
18
 
19
+
20
+
21
+
22
  st.set_page_config(page_title="GPT Streamlit Document Reasoner",layout="wide")
23
 
24
  menu = ["htm", "txt", "xlsx", "csv", "md", "py"] #619
 
149
  return ""
150
 
151
  def main():
152
+
153
+ openai_api_key = st.sidebar.text_input("Enter OpenAI API Key:", type='password')
154
+ if openai_api_key:
155
+ openai.api_key = openai_api_key
156
+ else:
157
+ st.error("Please provide the OpenAI API Key either through the input box or set the OPENAI_KEY environment variable.")
158
+
159
+
160
  user_prompt = st.text_area("Enter prompts, instructions & questions:", '', height=100)
161
 
162
  collength, colupload = st.columns([2,3]) # adjust the ratio as needed