Introduction to image generation applications

更新时间:
复制 MD 格式

FunctionAI provides one-click deployment for open source Stable Diffusion WebUI and ComfyUI applications. It offers full lifecycle management, from project development to API calls.

  • Project development phase: In this phase, you can debug prompts and workflows, install models and plugins, and generate images or videos that meet your expectations.

  • API call phase: The image generation environment is configured during the project development phase by installing models, plugins, and dependencies. During the API call phase, workflows run in this environment to generate images elastically and efficiently through Serverless APIs.

Benefits

One-click deployment and out-of-the-box experience

  • One-click deployment: You can start an image generation project with a single click. The end-to-end environment is set up in minutes.

  • Out-of-the-box: The service automatically allocates Serverless GPU computing power and storage resources. It provides pre-installed Stable Diffusion WebUI and ComfyUI environments, which eliminates the need to manually install dependencies.

Full lifecycle management from development to API calls

  • Simple project development that mirrors the local image generation experience. You can easily download models, install plugins, debug prompts and workflows, and quickly generate images.

  • Elastic and highly available API calls: The API call phase leverages the benefits of Serverless for high availability (HA), elasticity, and automatic scaling.

  • One-stop publishing: You can publish workflows that are tested during the development phase as elastic and highly available APIs.

China network acceleration to reduce latency

  • Model pre-caching: Over 50 common models are cached to improve download speeds.

  • Accelerated plugin downloads: The service uses a China-based GitHub source to accelerate plugin downloads and prevent cross-border connection timeouts.

  • Faster dependency installation: The service uses Alibaba Cloud PyPI sources to accelerate dependency installation.

Flexibility and openness

  • Custom model uploads: You can upload custom models that take effect immediately.

  • Custom plugin extensions: You can upload custom plugins through file management or by logging on to an instance to meet your specific needs.

Dedicated resources and enhanced security

  • Independent runtime environment: Projects have exclusive access to GPU resources, which prevents performance fluctuations caused by resource contention.

  • Isolated resource storage: Models and generated content are stored in your File Storage NAS to ensure data security.

Serverless computing power with elastic scaling and pay-as-you-go billing

  • Automatic elastic scaling: Serverless computing power automatically scales out to handle traffic bursts and peak loads.

  • Pay-as-you-go computing power: You are billed for computing power on demand. Compute resources are automatically released when there are no requests. This enables quick startup and shutdown, which reduces costs during idle periods (hibernation).

Enterprise-grade reliability

High service availability: Computing power is deployed across multiple zones for disaster recovery. If a single point of failure occurs, services are automatically migrated and recovered.

Workflow

During the project deployment phase, the required computing power and storage resources are created with a single click to start the out-of-the-box image generation project.

Project development phase

During the project development phase, you can use ComfyUI or Stable Diffusion WebUI to generate images or videos.

Starting a workspace launches a GPU function instance. In the workspace, you can download models, install plugins, and generate images and videos by debugging prompts and workflows. When you are finished, you can shut down the workspace, which destroys the function instance. You must restart the workspace to use it again.

API call phase

After you install models and plugins and debug prompts and workflows in ComfyUI and Stable Diffusion WebUI, you can publish the API. This action publishes the current workspace configuration, which includes the source code, plugins, and dependency packages required by ComfyUI or Stable Diffusion WebUI.

Publishing an API creates a new function. You can configure new resource specifications and elastic policies to generate images elastically using the Serverless API. You can also configure settings to save the generated images to Object Storage Service (OSS). For more information, see the documentation for the ComfyUI Serverless API and Stable Diffusion Serverless API.

Transition between development and API call phases

When you publish an API, the source code, plugins, and dependencies from the ComfyUI or Stable Diffusion WebUI workspace are packaged and saved as a snapshot. When a function instance starts during the API call phase, it loads the snapshot to restore the environment from the project development phase and then executes the image generation request.

The compute resources and plugins for the API call phase are isolated from those in the project development phase. Only the models are shared. Therefore, changes to plugins and dependencies during the project development phase do not affect API calls. To apply these changes to API calls, you must republish the API. The new configuration takes effect for newly launched function instances.

Architecture and principles

image

The image generation application is an elastic and highly available application built on Serverless GPU computing power and cloud storage. The required compute and storage resources are automatically created during project deployment.

  • Serverless GPU computing power is provided by Function Compute (FC) GPU functions.

  • The storage products used are File Storage NAS, Object Storage Service (OSS), and Simple Log Service (SLS).

    • NAS is mounted to function instances to provide persistent storage for common ComfyUI and Stable Diffusion WebUI directories, such as the custom_nodes/, input/, output/, and models/ directories. It is also used to ensure the persistence of ComfyUI and Stable Diffusion WebUI snapshots.

    • Note

      A snapshot contains the project and dependency environment for ComfyUI and Stable Diffusion WebUI.

      When a workspace starts during the project development phase, it loads a snapshot. When the workspace is shut down, it saves the current state as a snapshot for the next startup.

      The project development and API call phases use separate snapshots, which serve as the link between them. When you publish an API, the environment from the project development phase is saved as a snapshot for the API call phase. This allows the API to run using the new snapshot.

    • SLS is used to store logs that are generated during project execution.

    • OSS can be used to store images or videos that you generate during the API call phase. For more information, see the API call documentation.