I think the face cascade doesn’t find any faces and this loop:
for (x, y, w, h) in faces:
    image_as_arr = np.array(frame)[y:y + w, x:x + h]
    return Image.fromarray(image_as_arr.astype('uint8'), 'RGB')

will be empty.
Since you don’t have any other return statement, your transformation will return None by default.
If you add an assert before the loop and check faces for a valid entry, you should see an exception.