phyloforfun commited on
Commit
3b60ff3
1 Parent(s): 04463cb

Major update. Support for 15 LLMs, World Flora Online taxonomy validation, geolocation, 2 OCR methods, significant UI changes, stability improvements, consistent JSON parsing

Browse files
vouchervision/VoucherVision_Config_Builder.py CHANGED
@@ -584,23 +584,26 @@ def has_API_key(val):
584
  else:
585
  return False
586
 
587
- def check_if_usable():
588
- dir_home = os.path.dirname(os.path.dirname(__file__))
589
- path_cfg_private = os.path.join(dir_home, 'PRIVATE_DATA.yaml')
590
- cfg_private = get_cfg_from_full_path(path_cfg_private)
 
 
 
591
 
592
- has_key_openai = has_API_key(cfg_private['openai']['OPENAI_API_KEY'])
593
 
594
- has_key_azure_openai = has_API_key(cfg_private['openai_azure']['api_version'])
595
 
596
- has_key_palm2 = has_API_key(cfg_private['google_palm']['google_palm_api'])
597
-
598
- has_key_google_OCR = has_API_key(cfg_private['google_cloud']['path_json_file'])
599
 
600
- if has_key_google_OCR and (has_key_azure_openai or has_key_openai or has_key_palm2):
601
- return True
602
- else:
603
- return False
604
 
605
  def check_API_key(dir_home, api_version):
606
  dir_home = os.path.dirname(os.path.dirname(__file__))
 
584
  else:
585
  return False
586
 
587
+ def check_if_usable(is_hf): ############################################################################################################## TODO fix
588
+ if is_hf:
589
+ return True ########### needs actual logic. borrow from another function to not repeat this
590
+ else:
591
+ dir_home = os.path.dirname(os.path.dirname(__file__))
592
+ path_cfg_private = os.path.join(dir_home, 'PRIVATE_DATA.yaml')
593
+ cfg_private = get_cfg_from_full_path(path_cfg_private)
594
 
595
+ has_key_openai = has_API_key(cfg_private['openai']['OPENAI_API_KEY'])
596
 
597
+ has_key_azure_openai = has_API_key(cfg_private['openai_azure']['api_version'])
598
 
599
+ has_key_palm2 = has_API_key(cfg_private['google_palm']['google_palm_api'])
600
+
601
+ has_key_google_OCR = has_API_key(cfg_private['google_cloud']['path_json_file'])
602
 
603
+ if has_key_google_OCR and (has_key_azure_openai or has_key_openai or has_key_palm2):
604
+ return True
605
+ else:
606
+ return False
607
 
608
  def check_API_key(dir_home, api_version):
609
  dir_home = os.path.dirname(os.path.dirname(__file__))