Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
Unable to run Bedrock for Image Generation using Stability AI model
Post Flair (click to view more posts with a particular flair)
Post Body

SOLVED

Hi all,

I have been trying for 1 day and am out of options, the documentation for the AWS Bedrock API is quite poor to be honest. I am invoking text-to-image Stability AI model from a python lambda function. I have tried my prompt and all the parameters from the AWS CLI and it works fine. but I keep getting the following response using the API: "HTTP Status Code: 200", but then when I see the contents of the botocore.response.StreamingBody object I get : {'Output': {'__type': 'com.amazon.coral.service#UnknownOperationException'}, 'Version': '1.0'}. At first I thought I was decoding the output Base64 incorrectly and tried different things to manipulate the object, but in the end I realized that this is the actual output that the model is giving me. What puzzles me is that I am getting an HTTP Status Code of 200 but then not getting the Base64 object as it should. Anyone has an idea?

I have tried with all the parameters for the model, without the parameters (they are all optional), with different text prompts, etc. Always the same response.

To give more context, here is my Bedrock Request:

bedrock_body = {'text_prompts': [{'text': 'Sri lanka tea plantation', 'weight': 1}]}        
response = invoke_bedrock(
            provider="stability",
            model_id="stable-diffusion-xl-v1",
            payload=json.dumps(bedrock_body),
            embeddings=false
        )

And this is the response:

{'ResponseMetadata': {'RequestId': '65578504-6360-496d-9786-adb135ae866c', 'HTTPStatusCode': 200, 'HTTPHeaders': {'date': 'Tue, 21 May 2024 18:54:15 GMT', 'content-type': 'application/json', 'content-length': '90', 'connection': 'keep-alive', 'x-amzn-requestid': '65578504-6360-496d-9786-adb135ae866c'}, 'RetryAttempts': 0}, 'contentType': 'application/json', 'body': <botocore.response.StreamingBody object at 0x7fe524a19cf0>}

After json_output = json.loads(response['body'].read())

I get:

json_output:  {'Output': {'__type': 'com.amazon.coral.service#UnknownOperationException'}, 'Version': '1.0'}

Author
Account Strength
100%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
2,764
Link Karma
259
Comment Karma
2,505
Profile updated: 3 days ago
Posts updated: 3 weeks ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
5 months ago