"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',}
res=requests.post(face_api_url, params=params, heads=headers, data=binary_img)
"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 https://qiita.com/ryo19841204/items/74d663b08e56345e3b60
endpoint='https://20YYMMDDxxxx.cognitiveservices.azure.com/' #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.
366 Is there any other way to save the Python database?
374 I want an event to happen when I click on a particular image on tkinter.
353 I want to create an array of sequences from "1" to a specified number.
345 Who developed the "avformat-59.dll" that comes with FFmpeg?
361 Add dataframe values of the same structure without column names
© 2023 OneMinuteCode. All rights reserved.