-2

I have this code. However I am not able to run it as a function.

def verify_result_same():
    if verify_result_same.is_identical() & verify_result_same.confidence() > 0.5:
            face_client.face.verify_face_to_face(source_image1_id, detected_faces_ids[0])
            print('Faces from {} & {} are of the same person, with confidence: {}'
            .format(source_image_file_name1, target_image_file_names[0], verify_result_same.confidence))
            print("Valid face verification")

    else: 
            print('Faces from {} & {} are of a different person, with confidence: {}'
            .format(source_image_file_name1, target_image_file_names[0], verify_result_same.confidence))
            print("Invalid face verification")
            text = "Face verification is not valid. Please try again."
            send_msg(text)

I am getting errors such as:

AttributeError: 'function' object has no attribute 'is_identical'
AttributeError: 'function' object has no attribute 'confidence'

Anyone can help?

rioV8
  • 24,506
  • 3
  • 32
  • 49
  • What are `is_identical` and `confidence`? and why are you trying to call them from `verify_result_same`? – Guy Jan 09 '22 at 10:44
  • 1
    I don't see why this would work to begin with? Where are these variable declarations, and more importantly, you shouldn't be able to access them from a function, nor meta call the function and access it either. – Larry the Llama Jan 09 '22 at 10:44
  • What are you checking for *is_identical* and *confidence*, this given function? Please expand your question. – Mathew O'Sullivan Jan 09 '22 at 10:45
  • use `f` strings: `f"some text {some_var}"` – rioV8 Jan 09 '22 at 12:21

2 Answers2

0
if verify_result_same.is_identical() & verify_result_same.is_confident() < 0.5:

Here you have used "verify_result_same" object which is same as the function you defined in the previous line.

Ayush K M
  • 1
  • 1
0

verify_result_same is a function, and you maybe have defined a class named verify_result_same. So you should rename your function name from verify_result_same to something others.

Steven-MSFT
  • 7,438
  • 1
  • 5
  • 13