NameError: name 'face_api_url' is not defined

Asked 2 months ago, Updated 2 months ago, 3 views

"NameError: name 'face_api_url' is not defined" issue appeared
If you erase the face_api_url itself, the next one is NameError: name 'binary_img' is not defined.
I'm trying this and that, but I'm running out of solutions, so please explain it in an easy-to-understand way.
By the way, I am an amateur in programming.

headers={'Content-Type':'application/octet-stream', 'Ocp-Apim-Subscription-Key':subscription_key}
param={'returnFaceId': 'true', 'returnFaceAttributes': 'age,gender,headPose,smile,facialHair,glaces,emotion,hair,makeup,occurrence,accessories,blur,exposure,noise',}, params=params, heads=headers, data=binary_img)

python jupyter-lab

2022-09-30 12:10

1 Answers

"NameError: name 'face_api_url' is not defined"

Error when the variable is not defined
You must declare face_api_url before you know what python means by face_api_url and display the 'variable name' is not defined error.

#Diverting code from the following site
endpoint='' #Azure API Endpoint
face_api_url = endpoint + 'face/v1.0/detect'

How to get the endpoint is explained by Youtube commentary video up to 32 minutes.

binary_img has similar errors.
The binary_img variable must contain image data retrieved from the Internet or stored on your computer.

There are many ways to store it, so I will not deal with it in my answer.
If you encounter another problem, we recommend that you create short reproducible sample code and ask new questions.

2022-09-30 12:10

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.