mirror of
https://github.com/StefBuwalda/ProjectIOT.git
synced 2025-10-30 19:29:57 +00:00
BUNCH OF TRASH
This commit is contained in:
13
server.py
13
server.py
@@ -24,21 +24,15 @@ def home():
|
||||
return "Hello, World!"
|
||||
|
||||
|
||||
i = 0
|
||||
|
||||
|
||||
# API to process vehicle
|
||||
@app.route("/api", methods=["POST"])
|
||||
def data():
|
||||
data = request.data
|
||||
global i
|
||||
|
||||
with open(f"image{i}.jpg", "wb") as f:
|
||||
with open("image.jpg", "wb") as f:
|
||||
f.write(data)
|
||||
|
||||
status = asyncio.run(process_image(f"image{i}.jpg"))
|
||||
|
||||
i += 1
|
||||
status = asyncio.run(process_image("image.jpg"))
|
||||
return jsonify(
|
||||
{
|
||||
"message": "Image sent succesfully",
|
||||
@@ -48,8 +42,9 @@ def data():
|
||||
|
||||
|
||||
async def process_image(file: str) -> bool:
|
||||
print("Processing image")
|
||||
anpr = ANPR()
|
||||
anpr_info: ... = await anpr.detect(file) # type: ignore
|
||||
anpr_info = await anpr.detect(file) # type: ignore
|
||||
number_plate = anpr_info["plate_number"]
|
||||
if number_plate:
|
||||
allowed = (
|
||||
|
||||
Reference in New Issue
Block a user