fix: ner_tryexcept_scope
@@ -113,6 +113,7 @@ def get_result(request):
last_utterances = request.json["last_utterances"]
logger.info(f"input (the last utterances): {last_utterances}")
+ try:
samples = []
dialog_ids = []
for i, utterance_sents in enumerate(last_utterances):
@@ -130,6 +131,10 @@ def get_result(request):
curr_ids = np.where(dialog_ids == i)[0]
curr_preds = [good_preds[curr_id] for curr_id in curr_ids]
ret.append(curr_preds)
+ except Exception as e:
+ sentry_sdk.capture_exception(e)
+ logger.exception(e)
+ ret = [[]] * len(last_utterances)
logger.info(f"NER output: {ret}")
total_time = time.time() - st_time
