phyloforfun commited on
Commit
5b17165
1 Parent(s): 17e4e25

update set api keys

Browse files
app.py CHANGED
@@ -276,165 +276,188 @@ def create_space_saver():
276
  st.session_state.config['leafmachine']['project']['delete_all_temps'] = st.checkbox("Keep only the final transcription file", st.session_state.config['leafmachine']['project'].get('delete_all_temps', False),help="*WARNING:* This limits your ability to do quality assurance. This will delete all folders created by VoucherVision, leaving only the `transcription.xlsx` file.")
277
 
278
 
279
- # def create_private_file():
280
- # st.session_state.proceed_to_main = False
281
 
282
- # if st.session_state.private_file:
283
- # cfg_private = get_private_file()
284
- # create_private_file_0(cfg_private)
285
- # else:
286
- # st.title("VoucherVision")
287
- # create_private_file_0()
288
 
289
- # def create_private_file():
290
- # st.session_state.proceed_to_main = False
291
- # st.title("VoucherVision")
292
- # col_private,_= st.columns([12,2])
 
 
 
 
 
 
 
 
 
 
 
 
 
293
 
294
- # if st.session_state.private_file:
295
- # cfg_private = get_private_file()
296
- # else:
297
- # cfg_private = {}
298
- # cfg_private['openai'] = {}
299
- # cfg_private['openai']['OPENAI_API_KEY'] =''
300
-
301
- # cfg_private['openai_azure'] = {}
302
- # cfg_private['openai_azure']['openai_api_key'] = ''
303
- # cfg_private['openai_azure']['api_version'] = ''
304
- # cfg_private['openai_azure']['openai_api_base'] =''
305
- # cfg_private['openai_azure']['openai_organization'] =''
306
- # cfg_private['openai_azure']['openai_api_type'] =''
307
-
308
- # cfg_private['google_cloud'] = {}
309
- # cfg_private['google_cloud']['path_json_file'] =''
310
-
311
- # cfg_private['google_palm'] = {}
312
- # cfg_private['google_palm']['google_palm_api'] =''
313
-
314
 
315
- # with col_private:
316
- # st.header("Set API keys")
317
- # st.info("***Note:*** There is a known bug with tabs in Streamlit. If you update an input field it may take you back to the 'Project Settings' tab. Changes that you made are saved, it's just an annoying glitch. We are aware of this issue and will fix it as soon as we can.")
318
- # st.warning("To commit changes to API keys you must press the 'Set API Keys' button at the bottom of the page.")
319
- # st.write("Before using VoucherVision you must set your API keys. All keys are stored locally on your computer and are never made public.")
320
- # st.write("API keys are stored in `../VoucherVision/PRIVATE_DATA.yaml`.")
321
- # st.write("Deleting this file will allow you to reset API keys. Alternatively, you can edit the keys in the user interface.")
322
- # st.write("Leave keys blank if you do not intend to use that service.")
 
323
 
324
- # st.write("---")
325
- # st.subheader("Google Vision (*Required*)")
326
- # st.markdown("VoucherVision currently uses [Google Vision API](https://cloud.google.com/vision/docs/ocr) for OCR. Generating an API key for this is more involved than the others. [Please carefully follow the instructions outlined here to create and setup your account.](https://cloud.google.com/vision/docs/setup) ")
327
- # st.markdown("""
328
- # Once your account is created, [visit this page](https://console.cloud.google.com) and create a project. Then follow these instructions:
329
-
330
- # - **Select your Project**: If you have multiple projects, ensure you select the one where you've enabled the Vision API.
331
- # - **Open the Navigation Menu**: Click on the hamburger menu (three horizontal lines) in the top left corner.
332
- # - **Go to IAM & Admin**: In the navigation pane, hover over "IAM & Admin" and then click on "Service accounts."
333
- # - **Locate Your Service Account**: Find the service account for which you wish to download the JSON key. If you haven't created a service account yet, you'll need to do so by clicking the "CREATE SERVICE ACCOUNT" button at the top.
334
- # - **Download the JSON Key**:
335
- # - Click on the three dots (actions menu) on the right side of your service account name.
336
- # - Select "Manage keys."
337
- # - In the pop-up window, click on the "ADD KEY" button and select "JSON."
338
- # - The JSON key file will automatically be downloaded to your computer.
339
- # - **Store Safely**: This file contains sensitive data that can be used to authenticate and bill your Google Cloud account. Never commit it to public repositories or expose it in any way. Always keep it safe and secure.
340
- # """)
341
- # with st.container():
342
- # c_in_ocr, c_button_ocr = st.columns([10,2])
343
- # with c_in_ocr:
344
- # google_vision = st.text_input(label = 'Full path to Google Cloud JSON API key file', value = cfg_private['google_cloud'].get('path_json_file', ''),
345
- # placeholder = 'e.g. C:/Documents/Secret_Files/google_API/application_default_credentials.json',
346
- # help ="This API Key is in the form of a JSON file. Please save the JSON file in a safe directory. DO NOT store the JSON key inside of the VoucherVision directory.",
347
- # type='password',key='924857298734590283750932809238')
348
- # with c_button_ocr:
349
- # st.empty()
350
 
351
 
352
- # st.write("---")
353
- # st.subheader("OpenAI")
354
- # st.markdown("API key for first-party OpenAI API. Create an account with OpenAI [here](https://platform.openai.com/signup), then create an API key [here](https://platform.openai.com/account/api-keys).")
355
- # with st.container():
356
- # c_in_openai, c_button_openai = st.columns([10,2])
357
- # with c_in_openai:
358
- # openai_api_key = st.text_input("openai_api_key", cfg_private['openai'].get('OPENAI_API_KEY', ''),
359
- # help='The actual API key. Likely to be a string of 2 character, a dash, and then a 48-character string: sk-XXXXXXXX...',
360
- # placeholder = 'e.g. sk-XXXXXXXX...',
361
- # type='password')
362
- # with c_button_openai:
363
- # st.empty()
364
-
365
- # st.write("---")
366
- # st.subheader("OpenAI - Azure")
367
- # st.markdown("This version OpenAI relies on Azure servers directly as is intended for private enterprise instances of OpenAI's services, such as [UM-GPT](https://its.umich.edu/computing/ai). Administrators will provide you with the following information.")
368
- # azure_openai_api_version = st.text_input("azure_openai_api_version", cfg_private['openai_azure'].get('api_version', ''),
369
- # help='API Version e.g. "2023-05-15"',
370
- # placeholder = 'e.g. 2023-05-15',
371
- # type='password')
372
- # azure_openai_api_key = st.text_input("azure_openai_api_key", cfg_private['openai_azure'].get('openai_api_key', ''),
373
- # help='The actual API key. Likely to be a 32-character string',
374
- # placeholder = 'e.g. 12333333333333333333333333333332',
375
- # type='password')
376
- # azure_openai_api_base = st.text_input("azure_openai_api_base", cfg_private['openai_azure'].get('openai_api_base', ''),
377
- # help='The base url for the API e.g. "https://api.umgpt.umich.edu/azure-openai-api"',
378
- # placeholder = 'e.g. https://api.umgpt.umich.edu/azure-openai-api',
379
- # type='password')
380
- # azure_openai_organization = st.text_input("azure_openai_organization", cfg_private['openai_azure'].get('openai_organization', ''),
381
- # help='Your organization code. Likely a short string',
382
- # placeholder = 'e.g. 123456',
383
- # type='password')
384
- # azure_openai_api_type = st.text_input("azure_openai_api_type", cfg_private['openai_azure'].get('openai_api_type', ''),
385
- # help='The API type. Typically "azure"',
386
- # placeholder = 'e.g. azure',
387
- # type='password')
388
- # with st.container():
389
- # c_in_azure, c_button_azure = st.columns([10,2])
390
- # with c_button_azure:
391
- # st.empty()
392
 
393
- # st.write("---")
394
- # st.subheader("Google PaLM 2")
395
- # st.markdown('Follow these [instructions](https://developers.generativeai.google/tutorials/setup) to generate an API key for PaLM 2. You may need to also activate an account with [MakerSuite](https://makersuite.google.com/app/apikey) and enable "early access."')
396
- # with st.container():
397
- # c_in_palm, c_button_palm = st.columns([10,2])
398
- # with c_in_palm:
399
- # google_palm = st.text_input("Google PaLM 2 API Key", cfg_private['google_palm'].get('google_palm_api', ''),
400
- # help='The MakerSuite API key e.g. a 32-character string',
401
- # placeholder='e.g. SATgthsykuE64FgrrrrEervr3S4455t_geyDeGq',
402
- # type='password')
403
-
404
- # with st.container():
405
- # with c_button_ocr:
406
- # st.write("##")
407
- # st.button("Test OCR", on_click=test_API, args=['google_vision',c_in_ocr, cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,
408
- # azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
409
-
410
- # with st.container():
411
- # with c_button_openai:
412
- # st.write("##")
413
- # st.button("Test OpenAI", on_click=test_API, args=['openai',c_in_openai, cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,
414
- # azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
415
 
416
- # with st.container():
417
- # with c_button_azure:
418
- # st.write("##")
419
- # st.button("Test Azure OpenAI", on_click=test_API, args=['azure_openai',c_in_azure, cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,
420
- # azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
421
 
422
- # with st.container():
423
- # with c_button_palm:
424
- # st.write("##")
425
- # st.button("Test PaLM 2", on_click=test_API, args=['palm',c_in_palm, cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,
426
- # azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
427
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
- # st.button("Set API Keys",type='primary', on_click=save_changes_to_API_keys, args=[cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,
430
- # azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
431
- # if st.button('Proceed to VoucherVision'):
432
- # st.session_state.proceed_to_private = False
433
- # st.session_state.proceed_to_main = True
434
-
435
- def test_API(api, message_loc, cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key, azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm):
436
  # Save the API keys
437
- save_changes_to_API_keys(cfg_private,openai_api_key,azure_openai_api_version,azure_openai_api_key,azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm)
 
 
 
438
 
439
  with st.spinner('Performing validation checks...'):
440
  if api == 'google_vision':
@@ -1337,8 +1360,8 @@ if 'proceed_to_main' not in st.session_state:
1337
 
1338
  if 'proceed_to_build_llm_prompt' not in st.session_state:
1339
  st.session_state.proceed_to_build_llm_prompt = False # New state variable to control the flow
1340
- # if 'proceed_to_private' not in st.session_state:
1341
- # st.session_state.proceed_to_private = False # New state variable to control the flow
1342
 
1343
  # if 'private_file' not in st.session_state:
1344
  # st.session_state.private_file = does_private_file_exist()
@@ -1355,8 +1378,7 @@ if 'zip_filepath' not in st.session_state:
1355
 
1356
 
1357
  # if not st.session_state.private_file:
1358
- # # create_private_file()
1359
- # st.header()
1360
  if st.session_state.proceed_to_build_llm_prompt:
1361
  build_LLM_prompt_config()
1362
  # elif st.session_state.proceed_to_private:
 
276
  st.session_state.config['leafmachine']['project']['delete_all_temps'] = st.checkbox("Keep only the final transcription file", st.session_state.config['leafmachine']['project'].get('delete_all_temps', False),help="*WARNING:* This limits your ability to do quality assurance. This will delete all folders created by VoucherVision, leaving only the `transcription.xlsx` file.")
277
 
278
 
 
 
279
 
 
 
 
 
 
 
280
 
281
+ def create_private_file():
282
+ st.session_state.proceed_to_main = False
283
+ st.title("VoucherVision")
284
+ col_private, _ = st.columns([12, 2])
285
+
286
+ # Fetch the environment variables or set to empty if not found
287
+ env_variables = {
288
+ 'OPENAI_API_KEY': os.getenv('OPENAI_API_KEY'),
289
+ 'AZURE_API_VERSION': os.getenv('AZURE_API_VERSION'),
290
+ 'AZURE_API_KEY': os.getenv('AZURE_API_KEY'),
291
+ 'AZURE_API_BASE': os.getenv('AZURE_API_BASE'),
292
+ 'AZURE_ORGANIZATION': os.getenv('AZURE_ORGANIZATION'),
293
+ 'AZURE_API_TYPE': os.getenv('AZURE_API_TYPE'),
294
+ 'AZURE_DEPLOYMENT_NAME': os.getenv('AZURE_DEPLOYMENT_NAME'),
295
+ 'GOOGLE_APPLICATION_CREDENTIALS': os.getenv('GOOGLE_APPLICATION_CREDENTIALS'),
296
+ 'GOOGLE_PALM_API': os.getenv('GOOGLE_PALM_API')
297
+ }
298
 
299
+ # Check if all environment variables are set
300
+ all_env_set = all(value is not None for value in env_variables.values())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
 
302
+ with col_private:
303
+ # Your existing UI code for showing the forms goes here
304
+ st.header("Set API keys")
305
+ st.info("***Note:*** There is a known bug with tabs in Streamlit. If you update an input field it may take you back to the 'Project Settings' tab. Changes that you made are saved, it's just an annoying glitch. We are aware of this issue and will fix it as soon as we can.")
306
+ st.warning("To commit changes to API keys you must press the 'Set API Keys' button at the bottom of the page.")
307
+ st.write("Before using VoucherVision you must set your API keys. All keys are stored locally on your computer and are never made public.")
308
+ st.write("API keys are stored in `../VoucherVision/PRIVATE_DATA.yaml`.")
309
+ st.write("Deleting this file will allow you to reset API keys. Alternatively, you can edit the keys in the user interface.")
310
+ st.write("Leave keys blank if you do not intend to use that service.")
311
 
312
+ st.write("---")
313
+ st.subheader("Google Vision (*Required*)")
314
+ st.markdown("VoucherVision currently uses [Google Vision API](https://cloud.google.com/vision/docs/ocr) for OCR. Generating an API key for this is more involved than the others. [Please carefully follow the instructions outlined here to create and setup your account.](https://cloud.google.com/vision/docs/setup) ")
315
+ st.markdown("""
316
+ Once your account is created, [visit this page](https://console.cloud.google.com) and create a project. Then follow these instructions:
317
+
318
+ - **Select your Project**: If you have multiple projects, ensure you select the one where you've enabled the Vision API.
319
+ - **Open the Navigation Menu**: Click on the hamburger menu (three horizontal lines) in the top left corner.
320
+ - **Go to IAM & Admin**: In the navigation pane, hover over "IAM & Admin" and then click on "Service accounts."
321
+ - **Locate Your Service Account**: Find the service account for which you wish to download the JSON key. If you haven't created a service account yet, you'll need to do so by clicking the "CREATE SERVICE ACCOUNT" button at the top.
322
+ - **Download the JSON Key**:
323
+ - Click on the three dots (actions menu) on the right side of your service account name.
324
+ - Select "Manage keys."
325
+ - In the pop-up window, click on the "ADD KEY" button and select "JSON."
326
+ - The JSON key file will automatically be downloaded to your computer.
327
+ - **Store Safely**: This file contains sensitive data that can be used to authenticate and bill your Google Cloud account. Never commit it to public repositories or expose it in any way. Always keep it safe and secure.
328
+ """)
329
+ with st.container():
330
+ c_in_ocr, c_button_ocr = st.columns([10,2])
331
+ with c_in_ocr:
332
+ google_vision = st.text_input(label = 'Full path to Google Cloud JSON API key file', value = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''),
333
+ placeholder = 'e.g. copy contents of file application_default_credentials.json',
334
+ help ="This API Key is in the form of a JSON file. Please save the JSON file in a safe directory. DO NOT store the JSON key inside of the VoucherVision directory.",
335
+ type='password',key='924857298734590283750932809238')
336
+ with c_button_ocr:
337
+ st.empty()
338
 
339
 
340
+ st.write("---")
341
+ st.subheader("OpenAI")
342
+ st.markdown("API key for first-party OpenAI API. Create an account with OpenAI [here](https://platform.openai.com/signup), then create an API key [here](https://platform.openai.com/account/api-keys).")
343
+ with st.container():
344
+ c_in_openai, c_button_openai = st.columns([10,2])
345
+ with c_in_openai:
346
+ openai_api_key = st.text_input("openai_api_key", os.environ.get('OPENAI_API_KEY', ''),
347
+ help='The actual API key. Likely to be a string of 2 character, a dash, and then a 48-character string: sk-XXXXXXXX...',
348
+ placeholder = 'e.g. sk-XXXXXXXX...',
349
+ type='password')
350
+ with c_button_openai:
351
+ st.empty()
352
+
353
+ st.write("---")
354
+ st.subheader("OpenAI - Azure")
355
+ st.markdown("This version OpenAI relies on Azure servers directly as is intended for private enterprise instances of OpenAI's services, such as [UM-GPT](https://its.umich.edu/computing/ai). Administrators will provide you with the following information.")
356
+ azure_openai_api_version = st.text_input("azure_openai_api_version", os.environ.get('AZURE_API_VERSION', ''),
357
+ help='API Version e.g. "2023-05-15"',
358
+ placeholder = 'e.g. 2023-05-15',
359
+ type='password')
360
+ azure_openai_api_key = st.text_input("azure_openai_api_key", os.environ.get('AZURE_API_KEY', ''),
361
+ help='The actual API key. Likely to be a 32-character string',
362
+ placeholder = 'e.g. 12333333333333333333333333333332',
363
+ type='password')
364
+ azure_openai_api_base = st.text_input("azure_openai_api_base", os.environ.get('AZURE_API_BASE', ''),
365
+ help='The base url for the API e.g. "https://api.umgpt.umich.edu/azure-openai-api"',
366
+ placeholder = 'e.g. https://api.umgpt.umich.edu/azure-openai-api',
367
+ type='password')
368
+ azure_openai_organization = st.text_input("azure_openai_organization", os.environ.get('AZURE_ORGANIZATION', ''),
369
+ help='Your organization code. Likely a short string',
370
+ placeholder = 'e.g. 123456',
371
+ type='password')
372
+ azure_openai_api_type = st.text_input("azure_openai_api_type", os.environ.get('AZURE_API_TYPE', ''),
373
+ help='The API type. Typically "azure"',
374
+ placeholder = 'e.g. azure',
375
+ type='password')
376
+ with st.container():
377
+ c_in_azure, c_button_azure = st.columns([10,2])
378
+ with c_button_azure:
379
+ st.empty()
380
 
381
+ st.write("---")
382
+ st.subheader("Google PaLM 2")
383
+ st.markdown('Follow these [instructions](https://developers.generativeai.google/tutorials/setup) to generate an API key for PaLM 2. You may need to also activate an account with [MakerSuite](https://makersuite.google.com/app/apikey) and enable "early access."')
384
+ with st.container():
385
+ c_in_palm, c_button_palm = st.columns([10,2])
386
+ with c_in_palm:
387
+ google_palm = st.text_input("Google PaLM 2 API Key", os.environ.get('GOOGLE_PALM_API', ''),
388
+ help='The MakerSuite API key e.g. a 32-character string',
389
+ placeholder='e.g. SATgthsykuE64FgrrrrEervr3S4455t_geyDeGq',
390
+ type='password')
391
+
392
+ with st.container():
393
+ with c_button_ocr:
394
+ st.write("##")
395
+ st.button("Test OCR", on_click=test_API, args=['google_vision',c_in_ocr,openai_api_key,azure_openai_api_version,azure_openai_api_key,
396
+ azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
397
+
398
+ with st.container():
399
+ with c_button_openai:
400
+ st.write("##")
401
+ st.button("Test OpenAI", on_click=test_API, args=['openai',c_in_openai,openai_api_key,azure_openai_api_version,azure_openai_api_key,
402
+ azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
403
 
404
+ with st.container():
405
+ with c_button_azure:
406
+ st.write("##")
407
+ st.button("Test Azure OpenAI", on_click=test_API, args=['azure_openai',c_in_azure,openai_api_key,azure_openai_api_version,azure_openai_api_key,
408
+ azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
409
 
410
+ with st.container():
411
+ with c_button_palm:
412
+ st.write("##")
413
+ st.button("Test PaLM 2", on_click=test_API, args=['palm',c_in_palm,openai_api_key,azure_openai_api_version,azure_openai_api_key,
414
+ azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
415
+
416
+ st.button("Set API Keys",type='primary', on_click=set_API_keys, args=[openai_api_key,azure_openai_api_version,azure_openai_api_key,
417
+ azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm])
418
+
419
+ # # UI form for entering environment variables if not all are set
420
+ # with st.form("env_variables"):
421
+ # for var, value in env_variables.items():
422
+ # env_variables[var] = st.text_input(f"Enter {var}", value or "")
423
+ # submitted = st.form_submit_button("Submit")
424
+ # if submitted:
425
+ # # Assuming the environment variables should be set for the session
426
+ # for var, value in env_variables.items():
427
+ # os.environ[var] = value
428
+ # st.success("Environment variables updated. Please restart your app.")
429
+ if st.button('Proceed to VoucherVision'):
430
+ st.session_state.proceed_to_private = False
431
+ st.session_state.proceed_to_main = True
432
+
433
+ def set_API_keys(openai_api_key, azure_openai_api_version, azure_openai_api_key, azure_openai_api_base, azure_openai_organization, azure_openai_api_type, google_vision, google_palm):
434
+ # Set the environment variable if the key is not None or an empty string
435
+ if openai_api_key:
436
+ os.environ['OPENAI_API_KEY'] = openai_api_key
437
+ if azure_openai_api_version:
438
+ os.environ['AZURE_API_VERSION'] = azure_openai_api_version
439
+ if azure_openai_api_key:
440
+ os.environ['AZURE_API_KEY'] = azure_openai_api_key
441
+ if azure_openai_api_base:
442
+ os.environ['AZURE_API_BASE'] = azure_openai_api_base
443
+ if azure_openai_organization:
444
+ os.environ['AZURE_ORGANIZATION'] = azure_openai_organization
445
+ if azure_openai_api_type:
446
+ os.environ['AZURE_API_TYPE'] = azure_openai_api_type
447
+ if google_vision:
448
+ os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = google_vision
449
+ if google_palm:
450
+ os.environ['GOOGLE_PALM_API'] = google_palm
451
+
452
+ st.success("API keys set successfully!")
453
 
454
+
455
+ def test_API(api, message_loc,openai_api_key,azure_openai_api_version,azure_openai_api_key, azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm):
 
 
 
 
 
456
  # Save the API keys
457
+ # save_changes_to_API_keys(openai_api_key,azure_openai_api_version,azure_openai_api_key,azure_openai_api_base,azure_openai_organization,azure_openai_api_type,google_vision,google_palm)
458
+ set_API_keys(openai_api_key, azure_openai_api_version, azure_openai_api_key,
459
+ azure_openai_api_base, azure_openai_organization, azure_openai_api_type,
460
+ google_vision, google_palm)
461
 
462
  with st.spinner('Performing validation checks...'):
463
  if api == 'google_vision':
 
1360
 
1361
  if 'proceed_to_build_llm_prompt' not in st.session_state:
1362
  st.session_state.proceed_to_build_llm_prompt = False # New state variable to control the flow
1363
+ if 'proceed_to_private' not in st.session_state:
1364
+ st.session_state.proceed_to_private = False # New state variable to control the flow
1365
 
1366
  # if 'private_file' not in st.session_state:
1367
  # st.session_state.private_file = does_private_file_exist()
 
1378
 
1379
 
1380
  # if not st.session_state.private_file:
1381
+ # create_private_file()
 
1382
  if st.session_state.proceed_to_build_llm_prompt:
1383
  build_LLM_prompt_config()
1384
  # elif st.session_state.proceed_to_private:
vouchervision/VoucherVision_Config_Builder.py CHANGED
@@ -556,7 +556,7 @@ def has_API_key(key_name):
556
  # return False
557
  def check_if_usable():
558
  has_key_openai = os.getenv('OPENAI_API_KEY') is not None
559
- has_key_palm2 = os.getenv('PALM') is not None
560
  has_key_google_OCR = os.getenv('GOOGLE_APPLICATION_CREDENTIALS') is not None
561
 
562
  return has_key_google_OCR and (has_key_openai or has_key_palm2)
 
556
  # return False
557
  def check_if_usable():
558
  has_key_openai = os.getenv('OPENAI_API_KEY') is not None
559
+ has_key_palm2 = os.getenv('PALM_API_KEY') is not None
560
  has_key_google_OCR = os.getenv('GOOGLE_APPLICATION_CREDENTIALS') is not None
561
 
562
  return has_key_google_OCR and (has_key_openai or has_key_palm2)