How to intimate face not found in real time face detection project using opencv

while True:
   
    frames = pipeline.wait_for_frames()
    color_frame = frames.get_color_frame()

    # Convert depth_frame to numpy array to render image in opencv
    img = np.asanyarray(color_frame.get_data())
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces = face_cascade.detectMultiScale(gray, 1.3, 5)
    for (x, y, w, h) in faces:
        print(x, y, w, h)
        cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
        try:
            id, confidence = model.predict(gray[y :y + h, x :x + w])
            if confidence < 100:
                id = names[id]
                confidence = "  {0}%".format(round(100 - confidence))
            else:
                id = "unknown"
                confidence = "  {0}%".format(round(100 - confidence))
            cv2.putText(img, str(id), (x + 5, y - 5), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
            cv2.putText(img,
                        str(confidence),
                        (x + 5, y + h - 5),
                        cv2.FONT_HERSHEY_SIMPLEX,
                        1, (0, 0, 255), 2)
        except:
            cv2.putText(img, "Face not Found", (40, 40), cv2.FONT_HERSHEY_COMPLEX, 1, (0, 255, 0), 2)
            pass

    cv2.imshow(window_name, img);
    key = cv2.waitKey(1)
    # if pressed escape exit program
    if key == 27:
        cv2.destroyAllWindows()
        break
if len(faces)==0:
    cv2.putText(img, "Not found", (40, 40), cv2.FONT_HERSHEY_COMPLEX, 1, (0, 255, 0), 2)
else:
    for (x, y, w, h) in faces:
        ...