commit
57bceea5a9
@ -4,6 +4,7 @@ import urllib
|
||||
import random
|
||||
import numpy as np
|
||||
from pathlib import Path
|
||||
import urllib.parse
|
||||
import uuid
|
||||
from copy import deepcopy
|
||||
import sys, os
|
||||
@ -33,10 +34,18 @@ def sbt_predict(image_url, engine, metadata={}) -> None:
|
||||
img = cv2.imdecode(arr, -1)
|
||||
|
||||
save_dir = "./tmp_results"
|
||||
try:
|
||||
|
||||
parsed_url = urllib.parse.urlparse(image_url)
|
||||
query_params = urllib.parse.parse_qs(parsed_url.query)
|
||||
file_name = query_params['file_name'][0]
|
||||
except Exception as e:
|
||||
print(f"[ERROR]: Error extracting file name from url: {image_url}")
|
||||
file_name = f"{uuid.uuid4()}.jpg"
|
||||
os.makedirs(save_dir, exist_ok=True)
|
||||
# image_path = os.path.join(save_dir, f"{image_url}.jpg")
|
||||
os.makedirs(save_dir, exist_ok = True)
|
||||
tmp_image_path = os.path.join(save_dir, f"{uuid.uuid4()}.jpg")
|
||||
tmp_image_path = os.path.join(save_dir, file_name)
|
||||
cv2.imwrite(tmp_image_path, img)
|
||||
extra_params = {'sub': metadata.get("subsidiary", None)} # example of 'AU'
|
||||
outputs = process_img(img=tmp_image_path,
|
||||
|
@ -847,7 +847,6 @@ def calculate_a_request(report, request):
|
||||
rv_avg_acc = avg_dict(att["acc"]["reviewed"])
|
||||
|
||||
image.is_required = fb_avg_acc < settings.BAD_THRESHOLD
|
||||
image.is_reviewed = rv_avg_acc > 0
|
||||
|
||||
if image.processing_time < 0:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user