Update: more logging for model performance
This commit is contained in:
parent
0fafb8f565
commit
ad249a8c19
@ -20,12 +20,12 @@ def aggregate_result(results):
|
||||
doc_types = []
|
||||
for index, result in results.items():
|
||||
index = int(index)
|
||||
doc_type = result["metadata"]["doc_type"]
|
||||
doc_type = result.get("metadata", {}).get("doc_type", "all")
|
||||
doc_types.append(doc_type)
|
||||
sorted_results[index] = ((doc_type, result))
|
||||
|
||||
des_result = deepcopy(list(results.values()))[0]
|
||||
des_result.pop("metadata")
|
||||
des_result.pop("metadata", None)
|
||||
des_result["content"]["total_pages"] = 0
|
||||
des_result["content"]["ocr_num_pages"] = 0
|
||||
des_result["content"]["document"][0]["end_page"] = 0
|
||||
@ -162,15 +162,14 @@ def process_invoice_sbt_result(rq_id, result, metadata):
|
||||
ai_inference_profile = {}
|
||||
doc_type_string = ""
|
||||
for idx, result in results.items():
|
||||
ai_inference_profile["{doc_type}_{idx}".format(doc_type=result["metadata"]["doc_type"], idx=result["metadata"]["index_in_request"])] = result["metadata"]["ai_inference_profile"]
|
||||
doc_type_string += "{},".format(result["metadata"]["doc_type"])
|
||||
ai_inference_profile["{doc_type}_{idx}".format(doc_type=result.get("metadata", {}).get("doc_type", "all"), idx=result.get("metadata", {}).get("index_in_request", 0))] = result.get("metadata", {}).get("ai_inference_profile", {})
|
||||
doc_type_string += "{},".format(result.get("metadata", {}).get("doc_type", "all"))
|
||||
doc_type_string = doc_type_string[:-1]
|
||||
rq.ai_inference_profile = ai_inference_profile
|
||||
rq.doc_type = doc_type_string
|
||||
rq.ai_inference_start_time = result["metadata"]["ai_inference_start_time"] # advancing the last result
|
||||
rq.preprocessing_time = result["metadata"]["preprocessing_time"] # advancing the last result
|
||||
rq.ai_inference_start_time = result.get("metadata", {}).get("ai_inference_start_time", -1) # advancing the last result
|
||||
rq.preprocessing_time = result.get("metadata", {}).get("preprocessing_time", 0) # advancing the last result
|
||||
rq.ai_inference_time = time.time() - rq.ai_inference_start_time
|
||||
|
||||
rq.save()
|
||||
|
||||
else:
|
||||
|
@ -307,7 +307,7 @@ def token_value(token_type):
|
||||
return 1 # Basic OCR
|
||||
|
||||
|
||||
def send_to_queue2(rq_id, sub_id, file_url, user_id, typez, metadata):
|
||||
def send_to_queue2(rq_id, sub_id, file_url, user_id, typez, metadata={}):
|
||||
try:
|
||||
if typez == ProcessType.ID_CARD.value:
|
||||
c_connector.process_id(
|
||||
|
@ -79,7 +79,7 @@ def deploy():
|
||||
# Define the variable
|
||||
tag = str(random_hash()[:8])
|
||||
now = datetime.now()
|
||||
tag = tag + "_" + str(now.strftime("%d%m%y%H%M%S"))
|
||||
tag = str(now.strftime("%Y%m%d%H%M%S")) + "_" + tag
|
||||
# tag = "4cae5134_261223123256"
|
||||
print(tag)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user