Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Introduction to JumpStart - Text to Image (TypeError) #4515

Open
kaimatt1 opened this issue Jan 3, 2024 · 0 comments
Open

[Bug Report] Introduction to JumpStart - Text to Image (TypeError) #4515

kaimatt1 opened this issue Jan 3, 2024 · 0 comments

Comments

@kaimatt1
Copy link

kaimatt1 commented Jan 3, 2024

Link to the notebook
notebook link.

Describe the bug
. While running through the demo notebook ‘model-txt2img-stabilityai-stable-diffusion-v2-1-base-SDK_2’ there appears to be a TypeError with one of the functions defined (‘parse_response’); it assumes a string is being passed in but the previous function (‘query’) is returning a dictionary already.

def query(model_predictor, text):
    """Query the model predictor."""

    encoded_text = text.encode("utf-8")

    query_response = model_predictor.predict(
        encoded_text,
        {
            "ContentType": "application/x-text",
            "Accept": "application/json",
        },
    )
    return query_response


def parse_response(query_response):
    """Parse response and return generated image and the prompt"""

    response_dict = json.loads(query_response) ##### query response is already dict
    return response_dict["generated_image"], response_dict["prompt"]

To reproduce
Execute notebook as is returns TypeError: the JSON object must be str, bytes or bytearray, not dict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant