Skip to content

Commit

Permalink
solve bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ntchinda-Giscard committed May 26, 2024
1 parent 1451837 commit b9bb39a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ async def carplate(license: UploadFile = File(...)):
raise HTTPException(status_code=400, detail="License plate image is required.")
# Save the back image to disk
license_path = os.path.join(UPLOAD_DIR, 'car.jpg')
print(license_path)
with open(license_path, "wb") as license_file:
license_file.write(await license.read())
result = vehicle_dect(license_path)
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ocr_model = PaddleOCR(lang='en')
nlp_ner = spacy.load("output/model-best")
detector = YOLO('best.pt')
vehicle = YOLO('yolov8x.pt')
vehicle = YOLO('yolov8m.pt')

aws_access_key_id=os.getenv('AWS_ACESS_KEY')
aws_secret_access_key = os.getenv('AWS_SECRET_KEY')
Expand Down Expand Up @@ -146,7 +146,7 @@ def vehicle_dect(img: str) -> any:
num_plate = licence_dect(img_path)
color_thief = ColorThief(img_path)
dominant_color = color_thief.get_color(quality=1)
colors.append({"color": dominant_color, "plate": num_plate})
colors = {"color": dominant_color, "plate": num_plate}
for i in range(len(classes)):
final.append({ "type": classes[i], "car_data" : colors[i]})

Expand Down

0 comments on commit b9bb39a

Please sign in to comment.