shayan5422 commited on
Commit
e4b732c
·
verified ·
1 Parent(s): 463d45b

Upload add_model_explanations.py

Browse files
Files changed (1) hide show
  1. add_model_explanations.py +4 -1
add_model_explanations.py CHANGED
@@ -169,7 +169,9 @@ def process_json_file(filepath: str):
169
  return False
170
 
171
  # --- Check if explanation already exists ---
172
- if EXPLANATION_KEY in data and data[EXPLANATION_KEY]: # Check if key exists AND has non-empty content
 
 
173
  logging.info(f"[{model_id}] Explanation already exists. Skipping generation.")
174
  return False # Indicate no update was needed
175
 
@@ -177,6 +179,7 @@ def process_json_file(filepath: str):
177
  # if EXPLANATION_KEY in data: ...
178
 
179
  # --- Generation Logic ---
 
180
  description = data.get(DESCRIPTION_KEY)
181
  if not description:
182
  logging.warning(f"[{model_id}] Description field is missing or empty. Cannot generate explanation.")
 
169
  return False
170
 
171
  # --- Check if explanation already exists ---
172
+ existing_explanation = data.get(EXPLANATION_KEY)
173
+ logging.debug(f"[{model_id}] Checking for existing explanation. Key: '{EXPLANATION_KEY}'. Found value: '{existing_explanation}' (Type: {type(existing_explanation)})")
174
+ if existing_explanation: # Simplified check: Checks for non-empty string, non-None
175
  logging.info(f"[{model_id}] Explanation already exists. Skipping generation.")
176
  return False # Indicate no update was needed
177
 
 
179
  # if EXPLANATION_KEY in data: ...
180
 
181
  # --- Generation Logic ---
182
+ logging.info(f"[{model_id}] Existing explanation is missing or empty. Proceeding with generation.")
183
  description = data.get(DESCRIPTION_KEY)
184
  if not description:
185
  logging.warning(f"[{model_id}] Description field is missing or empty. Cannot generate explanation.")