Leon4gr45 commited on
Commit
c9b6f1c
·
verified ·
1 Parent(s): 51fbcb4

Update src/ui/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/ui/streamlit_app.py +11 -1
src/ui/streamlit_app.py CHANGED
@@ -86,6 +86,12 @@ def run_app():
86
  # Sidebar configuration
87
  st.sidebar.header("Configuration")
88
 
 
 
 
 
 
 
89
  model = st.sidebar.selectbox(
90
  "LLM Model",
91
  options=[
@@ -142,11 +148,15 @@ def run_app():
142
 
143
  # Run button
144
  if col1.button("Generate Hypotheses", type="primary", use_container_width=True):
 
 
 
145
  # Initialize AI Co-Scientist
146
  config = {
147
  "model": model if model else "gpt-3.5-turbo", # Ensure we never pass None as the model
148
  "temperature": temperature,
149
- "max_iterations": iterations
 
150
  }
151
 
152
  st.session_state.acs = AICoScientist(config=config)
 
86
  # Sidebar configuration
87
  st.sidebar.header("Configuration")
88
 
89
+ openai_api_key = st.sidebar.text_input(
90
+ "OpenAI API Key",
91
+ type="password",
92
+ help="Paste your OpenAI API key here. It will not be stored."
93
+ )
94
+
95
  model = st.sidebar.selectbox(
96
  "LLM Model",
97
  options=[
 
148
 
149
  # Run button
150
  if col1.button("Generate Hypotheses", type="primary", use_container_width=True):
151
+ # Set the OpenAI API key in the environment if provided
152
+ if openai_api_key:
153
+ os.environ["OPENAI_API_KEY"] = openai_api_key
154
  # Initialize AI Co-Scientist
155
  config = {
156
  "model": model if model else "gpt-3.5-turbo", # Ensure we never pass None as the model
157
  "temperature": temperature,
158
+ "max_iterations": iterations,
159
+ "openai_api_key": openai_api_key, # Pass the key for future-proofing
160
  }
161
 
162
  st.session_state.acs = AICoScientist(config=config)