Issue
Vertex AI created the below sample notebook. When I run it I get a unauthorized error. I don't see any exmaples on what the authentication setup would be like. Would it be a API key, username/password, etc? What would the code consist of?
!pip install --upgrade google-cloud-aiplatform
import base64
import vertexai
from vertexai.preview.generative_models import GenerativeModel
def generate():
model = GenerativeModel("gemini-pro-vision")
responses = model.generate_content(
["""What is the date today?"""],
generation_config={
"max_output_tokens": 2048,
"temperature": 0.4,
"top_p": 1,
"top_k": 32
},
)
print(responses)
generate()
Solution
The easiest way to do it locally is to add:
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="/key.json"
Before generate()
Get your project key in IAM / Service Accounts / Key -> Add Key -> Download as json
Answered By - razimbres
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.