Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Error js imagen 3 generation

Hello, 

Trying to Run this code:

const project = 'PPPPPPPPP';  
const location = 'us-central1';

// Import the Vertex AI library
const {PredictionServiceClient} = require('@google-cloud/aiplatform').v1;

// Set up the client
const client = new PredictionServiceClient();

async function generateImage() {

// Full endpoint for the model
const endpoint = `projects/${project}/locations/${location}/publishers/google/models/imagen-3.0-generate-001`;

// Create the request with the prompt
const request = {
endpoint: endpoint,
   instances: [
         {prompt: 'A futuristic cityscape at sunset'}
    ]
};

// Call the API to generate an image
try {
   const [response] = await client.predict(request);
    console.log('Generated Image:', response.predictions);
} catch (error) {
     console.error('Error generating image:', error);
}

}

generateImage();

===

I get the error:

Error generating image: Error: 12 UNIMPLEMENTED: Received HTTP status code 404

    at callErrorFromStatus (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/call.js:31:19)

    at Object.onReceiveStatus (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/client.js:193:76)

    at Object.onReceiveStatus (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:360:141)

    at Object.onReceiveStatus (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)

    at /Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/resolving-call.js:129:78

    at processTicksAndRejections (node:internal/process/task_queues:78:11)

for call at

    at ServiceClientImpl.makeUnaryRequest (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/client.js:161:32)

    at ServiceClientImpl.<anonymous> (/Users/uuuuu/vertexai/vertex_js_api/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)

    at /Users/uuuuu/vertexai/vertex_js_api/node_modules/@google-cloud/aiplatform/build/src/v1/prediction_service_client.js:277:29

    at /Users/uuuuu/vertexai/vertex_js_api/node_modules/google-gax/build/src/normalCalls/timeout.js:44:16

    at OngoingCallPromise.call (/Users/uuuuu/vertexai/vertex_js_api/node_modules/google-gax/build/src/call.js:67:27)

    at NormalApiCaller.call (/Users/uuuuu/vertexai/vertex_js_api/node_modules/google-gax/build/src/normalCalls/normalApiCaller.js:34:19)

    at /Users/uuuuu/vertexai/vertex_js_api/node_modules/google-gax/build/src/createApiCall.js:112:30

    at processTicksAndRejections (node:internal/process/task_queues:96:5) {

  code: 12,

  details: 'Received HTTP status code 404',

  metadata: Metadata { internalRepr: Map(0) {}, options: {} }

}

thanks! 

0 1 419
1 REPLY 1