Spaces:
Runtime error
Runtime error
Update App_Function_Libraries/Summarization/Summarization_General_Lib.py
Browse files
App_Function_Libraries/Summarization/Summarization_General_Lib.py
CHANGED
|
@@ -714,9 +714,9 @@ def summarize_with_openrouter(api_key, input_data, custom_prompt_arg, temp=None,
|
|
| 714 |
|
| 715 |
|
| 716 |
def summarize_with_huggingface(api_key, input_data, custom_prompt_arg, temp=None):
|
| 717 |
-
loaded_config_data = load_and_log_configs()
|
| 718 |
logging.debug("HuggingFace: Summarization process starting...")
|
| 719 |
try:
|
|
|
|
| 720 |
logging.debug("HuggingFace: Loading and validating configurations")
|
| 721 |
if loaded_config_data is None:
|
| 722 |
logging.error("Failed to load configuration data")
|
|
@@ -726,15 +726,6 @@ def summarize_with_huggingface(api_key, input_data, custom_prompt_arg, temp=None
|
|
| 726 |
if api_key and api_key.strip():
|
| 727 |
huggingface_api_key = api_key
|
| 728 |
logging.info("HuggingFace: Using API key provided as parameter")
|
| 729 |
-
else:
|
| 730 |
-
# If no parameter is provided, use the key from the config
|
| 731 |
-
huggingface_api_key = loaded_config_data['api_keys'].get('huggingface')
|
| 732 |
-
logging.debug(f"HuggingFace: API key from config: {huggingface_api_key[:5]}...{huggingface_api_key[-5:]}")
|
| 733 |
-
if huggingface_api_key:
|
| 734 |
-
logging.info("HuggingFace: Using API key from config file")
|
| 735 |
-
else:
|
| 736 |
-
logging.warning("HuggingFace: No API key found in config file")
|
| 737 |
-
|
| 738 |
else:
|
| 739 |
huggingface_api_key = os.getenv('HF_TOKEN')
|
| 740 |
# Final check to ensure we have a valid API key
|
|
|
|
| 714 |
|
| 715 |
|
| 716 |
def summarize_with_huggingface(api_key, input_data, custom_prompt_arg, temp=None):
|
|
|
|
| 717 |
logging.debug("HuggingFace: Summarization process starting...")
|
| 718 |
try:
|
| 719 |
+
loaded_config_data = None
|
| 720 |
logging.debug("HuggingFace: Loading and validating configurations")
|
| 721 |
if loaded_config_data is None:
|
| 722 |
logging.error("Failed to load configuration data")
|
|
|
|
| 726 |
if api_key and api_key.strip():
|
| 727 |
huggingface_api_key = api_key
|
| 728 |
logging.info("HuggingFace: Using API key provided as parameter")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 729 |
else:
|
| 730 |
huggingface_api_key = os.getenv('HF_TOKEN')
|
| 731 |
# Final check to ensure we have a valid API key
|