Spaces:
Running
Running
Commit
·
fdfdfc3
1
Parent(s):
7a93196
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- app.py +1 -1
- vouchervision/utils_VoucherVision.py +16 -15
app.py
CHANGED
|
@@ -2303,7 +2303,7 @@ st.set_page_config(layout="wide", page_icon='img/icon.ico', page_title='VoucherV
|
|
| 2303 |
|
| 2304 |
# Parse the 'is_hf' argument and set it in session state
|
| 2305 |
if 'is_hf' not in st.session_state:
|
| 2306 |
-
st.session_state['is_hf'] =
|
| 2307 |
|
| 2308 |
|
| 2309 |
#################################################################################################################################################
|
|
|
|
| 2303 |
|
| 2304 |
# Parse the 'is_hf' argument and set it in session state
|
| 2305 |
if 'is_hf' not in st.session_state:
|
| 2306 |
+
st.session_state['is_hf'] = True
|
| 2307 |
|
| 2308 |
|
| 2309 |
#################################################################################################################################################
|
vouchervision/utils_VoucherVision.py
CHANGED
|
@@ -427,21 +427,6 @@ class VoucherVision():
|
|
| 427 |
|
| 428 |
def set_API_keys(self):
|
| 429 |
if self.is_hf:
|
| 430 |
-
self.dir_home = os.path.dirname(os.path.dirname(__file__))
|
| 431 |
-
self.path_cfg_private = os.path.join(self.dir_home, 'PRIVATE_DATA.yaml')
|
| 432 |
-
self.cfg_private = get_cfg_from_full_path(self.path_cfg_private)
|
| 433 |
-
|
| 434 |
-
k_openai = self.cfg_private['openai']['OPENAI_API_KEY']
|
| 435 |
-
k_openai_azure = self.cfg_private['openai_azure']['OPENAI_API_VERSION']
|
| 436 |
-
|
| 437 |
-
k_google_project_id = self.cfg_private['google']['GOOGLE_PROJECT_ID']
|
| 438 |
-
k_google_location = self.cfg_private['google']['GOOGLE_LOCATION']
|
| 439 |
-
k_google_application_credentials = self.cfg_private['google']['GOOGLE_APPLICATION_CREDENTIALS']
|
| 440 |
-
|
| 441 |
-
k_mistral = self.cfg_private['mistral']['MISTRAL_API_KEY']
|
| 442 |
-
k_here = self.cfg_private['here']['API_KEY']
|
| 443 |
-
k_opencage = self.cfg_private['open_cage_geocode']['API_KEY']
|
| 444 |
-
else:
|
| 445 |
self.dir_home = os.path.dirname(os.path.dirname(__file__))
|
| 446 |
self.path_cfg_private = None
|
| 447 |
self.cfg_private = None
|
|
@@ -456,6 +441,22 @@ class VoucherVision():
|
|
| 456 |
k_mistral = os.getenv('MISTRAL_API_KEY')
|
| 457 |
k_here = os.getenv('HERE_API_KEY')
|
| 458 |
k_opencage = os.getenv('open_cage_geocode')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
|
| 460 |
|
| 461 |
self.has_key_openai = self.has_API_key(k_openai)
|
|
|
|
| 427 |
|
| 428 |
def set_API_keys(self):
|
| 429 |
if self.is_hf:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
self.dir_home = os.path.dirname(os.path.dirname(__file__))
|
| 431 |
self.path_cfg_private = None
|
| 432 |
self.cfg_private = None
|
|
|
|
| 441 |
k_mistral = os.getenv('MISTRAL_API_KEY')
|
| 442 |
k_here = os.getenv('HERE_API_KEY')
|
| 443 |
k_opencage = os.getenv('open_cage_geocode')
|
| 444 |
+
else:
|
| 445 |
+
self.dir_home = os.path.dirname(os.path.dirname(__file__))
|
| 446 |
+
self.path_cfg_private = os.path.join(self.dir_home, 'PRIVATE_DATA.yaml')
|
| 447 |
+
self.cfg_private = get_cfg_from_full_path(self.path_cfg_private)
|
| 448 |
+
|
| 449 |
+
k_openai = self.cfg_private['openai']['OPENAI_API_KEY']
|
| 450 |
+
k_openai_azure = self.cfg_private['openai_azure']['OPENAI_API_VERSION']
|
| 451 |
+
|
| 452 |
+
k_google_project_id = self.cfg_private['google']['GOOGLE_PROJECT_ID']
|
| 453 |
+
k_google_location = self.cfg_private['google']['GOOGLE_LOCATION']
|
| 454 |
+
k_google_application_credentials = self.cfg_private['google']['GOOGLE_APPLICATION_CREDENTIALS']
|
| 455 |
+
|
| 456 |
+
k_mistral = self.cfg_private['mistral']['MISTRAL_API_KEY']
|
| 457 |
+
k_here = self.cfg_private['here']['API_KEY']
|
| 458 |
+
k_opencage = self.cfg_private['open_cage_geocode']['API_KEY']
|
| 459 |
+
|
| 460 |
|
| 461 |
|
| 462 |
self.has_key_openai = self.has_API_key(k_openai)
|