mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 11:19:57 +00:00
refactoring + execution time
This commit is contained in:
16
application/api/image_processing.py
Normal file
16
application/api/image_processing.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from application import anpr
|
||||
import io
|
||||
|
||||
|
||||
async def process_image(image: bytes) -> str:
|
||||
print("Saving file to memory")
|
||||
image_file = io.BytesIO(image)
|
||||
|
||||
print("Processing image")
|
||||
anpr_info = await anpr.detect(image_file) # type: ignore
|
||||
|
||||
if anpr_info is None:
|
||||
print("Something went wrong with ANPR")
|
||||
return ""
|
||||
|
||||
return str(anpr_info["plate_number"])
|
||||
Reference in New Issue
Block a user