Microsoft Azure Face API gives APIErrorException: (InvalidRequest) Invalid request has been sent

207 Views Asked by At

enter image description here


face ID is None
Calling Face ID Generation
Catching Update Function
image URL is /media/missingpersons/IMG_20220827_191210.jpg
image Path is C:\Users\Dell\Desktop\FYP\media\missingpersons\IMG_20220827_191210.jpg
face ID is None
Calling Face ID Generation
Internal Server Error: /people/verify-missing-person/1
Traceback (most recent call last):
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 84, in view
    return self.dispatch(request, *args, **kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\mixins.py", line 73, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 119, in dispatch
    return handler(request, *args, **kwargs)
  File "C:\Users\Dell\Desktop\FYP\people\views.py", line 120, in post
    response_detected_face=generate_face_id(self.object.photo.path)
  File "C:\Users\Dell\Desktop\FYP\people\views.py", line 78, in generate_face_id
    response_detected_face = face_client.face.detect_with_stream(
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\azure\cognitiveservices\vision\face\operations\_face_operations.py", line 783, in detect_with_stream
    raise models.APIErrorException(self._deserialize, response)
azure.cognitiveservices.vision.face.models._models_py3.APIErrorException: (InvalidRequest) Invalid request has been sent.
[21/Mar/2023 20:58:45,600] - Broken pipe from ('127.0.0.1', 58067)

Internal Server Error: /people/verify-missing-person/1
Traceback (most recent call last):
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\exception.py", line 55, in inner
    response = get_response(request)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 84, in view
    return self.dispatch(request, *args, **kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\contrib\auth\mixins.py", line 73, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\django\views\generic\base.py", line 119, in dispatch
    return handler(request, *args, **kwargs)
  File "C:\Users\Dell\Desktop\FYP\people\views.py", line 120, in post
    response_detected_face=generate_face_id(self.object.photo.path)
  File "C:\Users\Dell\Desktop\FYP\people\views.py", line 78, in generate_face_id
    response_detected_face = face_client.face.detect_with_stream(
  File "C:\Users\Dell\AppData\Local\Programs\Python\Python39\lib\site-packages\azure\cognitiveservices\vision\face\operations\_face_operations.py", line 783, in detect_with_stream
    raise models.APIErrorException(self._deserialize, response)
azure.cognitiveservices.vision.face.models._models_py3.APIErrorException: (InvalidRequest) Invalid request has been sent.
[21/Mar/2023 20:59:25] "POST /people/verify-missing-person/1 HTTP/1.1" 500 92023

any help will be much appreciated

After many many attempts and hours of research, I have tried many other examples online and thought. Yet, still same error.

Seems the API doesnt like the .create request. any help will be much appreciated

0

There are 0 best solutions below