WebashalarForML commited on
Commit
d99a2b0
1 Parent(s): f8f385d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -112,15 +112,17 @@ def process_file():
112
  except Exception as e:
113
  logging.error(f"Error during LLM processing: {e}")
114
  logging.info("Running backup model...")
115
-
 
 
116
  # Run the backup model in case of an exception
117
- if extracted_text: # Ensure extracted_text has a value before using it
118
  text = json_to_llm_str(extracted_text)
119
  LLMdata = NER_Model(text)
120
  logging.info(f"NER model data: {LLMdata}")
121
  else:
122
  logging.warning("No extracted text available for backup model")
123
-
124
  cont_data = process_extracted_text(extracted_text)
125
  logging.info(f"Contextual data: {cont_data}")
126
 
 
112
  except Exception as e:
113
  logging.error(f"Error during LLM processing: {e}")
114
  logging.info("Running backup model...")
115
+
116
+ # Default assignment for LLMdata in case of error
117
+ LLMdata = {}
118
  # Run the backup model in case of an exception
119
+ if extracted_text:
120
  text = json_to_llm_str(extracted_text)
121
  LLMdata = NER_Model(text)
122
  logging.info(f"NER model data: {LLMdata}")
123
  else:
124
  logging.warning("No extracted text available for backup model")
125
+
126
  cont_data = process_extracted_text(extracted_text)
127
  logging.info(f"Contextual data: {cont_data}")
128