I am using vision api to extract text (document_text_detection) in my project for last two year and never faced this issue. Since yesterday the api is randomly responding with the error :
{ code: 3 message: "Invalid language hints." }
for the same image. I experimented with bunch of images, sometimes the api extracts text fine and sometimes throws "Invalid language hints" error for a same image.
I have tried updating vision api library from v1 to v2, sending language hints as 'en' still the same issue persist. I have looked into the Google documentation and checked StackOverFlow as well but unable to find any solution.
from google.cloud import vision
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = google_cred_file
vision_client = vision.ImageAnnotatorClient()
file = open(file_path,"rb")
image = vision.Image(content=file.read())
api_resp = vision_client.document_text_detection(image=image)
if api_resp.error.message:
log.error(api_resp)