You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
To reproduce
Execute notebook as is returns TypeError: the JSON object must be str, bytes or bytearray, not dict
The text was updated successfully, but these errors were encountered: