Add: Try for filename exrtaction
This commit is contained in:
parent
25245aa770
commit
e4b3d1079f
@ -34,9 +34,14 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user