parkpow / deep-license-plate-recognition

Automatic License Plate Recognition (ALPR) or Automatic Number Plate Recognition (ANPR) software that works with any camera.
https://platerecognizer.com/
MIT License
523 stars 122 forks source link

feat: (blur script) use new base64 image format #183

Closed danleyb2 closed 7 months ago

github-actions[bot] commented 7 months ago

Risk Level 2 - /home/runner/work/deep-license-plate-recognition/deep-license-plate-recognition/blur/main.py

The changes introduce a new dependency on base64 which is standard and safe, but there's a potential issue with the merge_paths function. The indentation of the else block seems incorrect, which could lead to a SyntaxError. The correct indentation should align with the if statement. Additionally, the error handling in the process function could be improved by checking the response status code more precisely. Here's the suggested change for the merge_paths function:

if common_prefix == \"/\":
    # Custom output dir, exclude the first (/images/) prefix
    lgr.debug(f\"path1: {path1}\")
    lgr.debug(f\"path2: {path2}\")
    path3 = Path(path1) / Path(*path2.parts[2:])
else:
    real_path = os.path.relpath(path2, common_prefix)
    lgr.debug(f\"common_prefix: {common_prefix}\")
    lgr.debug(f\"real_path: {real_path}\")
    path3 = path1 / Path(real_path)

return path3

For the process function, consider using response.raise_for_status() to raise an HTTPError if the response was unsuccessful:

response.raise_for_status()

🔧🐍🚦


Powered by Code Review GPT

marcbelmont commented 7 months ago

@danleyb2 Is the comment from GPT making sense?

danleyb2 commented 7 months ago

@marcbelmont GPT comment is not usefull,

  1. It talks about SyntaxError which doesn't exist.
  2. It suggest using response.raise_for_status() but i prefer raising an exception that contains the response.text as msg