I tried running a basic code to run on Pycharm by adding google-cloud-vision in the Interpreter Setting. But all I'm getting is 'Process finished with exit code 0'. What am I doing wrong?
import os, io
from google.cloud import vision_v1
from google.cloud.vision_v1 import types
credential_path = r'C:UsersilianPycharmProjectspythonProject2vision_api.json' #change folder
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = credential_path
client = vision_v1.ImageAnnotatorClient()
FILE_NAME = 'test.png'
FOLDER_PATH = r'C:UsersilianPycharmProjectspythonProject2'
with io.open(os.path.join(FOLDER_PATH, FILE_NAME), 'rb') as image_file:
content = image_file.read()
image = vision_v1.types.Image(content = content)
response = client.text_detection(image=image)
question from:
https://stackoverflow.com/questions/65932788/why-doesnt-google-vision-api-work-with-my-code 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…