Stability-AI / stability-sdk

SDK for interacting with stability.ai APIs (e.g. stable diffusion inference)
https://platform.stability.ai/
MIT License
2.41k stars 339 forks source link

The specified engine (ID stable-diffusion-v1-5) was not found. #267

Closed hoangngocthinh closed 7 months ago

hoangngocthinh commented 7 months ago
    status = StatusCode.NOT_FOUND
    details = "The specified engine (ID stable-diffusion-v1-5) was not found."
    debug_error_string = "UNKNOWN:Error received from peer ipv4:172.64.153.32:443 {grpc_message:"The specified engine (ID stable-diffusion-v1-5) was not found.", grpc_status:5, created_time:"2023-12-07T02:38:39.670726122+00:00"}"
>```
def get_api_key(cls):
    return client.StabilityInference(
        key=settings.STABILITY_KEY,
        engine=settings.STABILITY_ENGINE,
        upscale_engine=settings.STABILITY_UPSCALE_ENGINE,
        verbose=True,
    )

@classmethod
def generate_image(
    cls,
    text_search: str = "",
    num_outputs: int = settings.NUMBER_OUTPUT_IMAGES,
    height: int = 768,
    width: int = 1024,
):
    if num_outputs > 10:
        num_outputs = 10
    try:
        api_key = cls.get_api_key()
        answers = api_key.generate(
            prompt=text_search,
            height=height,
            width=width,
            samples=num_outputs,  # limit number images output are 10
            cfg_scale=settings.STABILITY_CFG_SCALE,
        )
    except Exception as ex:
        logger.exception(ex)
        return []

This is my code and stable diffusion sdk version: 0.8.5, python version 3.7