Skip to main content

Add your description here

Project description

Models API by ComfyDeploy

A collection of optimized ComfyUI-based cloud inference endpoints, built on ComfyDeploy and Modal.

Features

  • Optimized model loading and caching
  • Cloud-based inference endpoints
  • Easy workflow management through CLI
  • Extensible workflow system

Installation

uv add comfy-models

Usage

CLI Commands

uv tool install comfy-models

The package provides several CLI commands to manage workflows:

# List all available workflows
models ls

# Show detailed info about a workflow
models cat <workflow_name>

# Deploy a workflow to Modal
models deploy <workflow_name>

# Run a workflow locally
models run <workflow_name>

# Test a workflow
models test <workflow_name>

Environment Setup

Create a .env file in your project root:

MODAL_VOLUME_NAME=your_modal_volume_name
HF_TOKEN=your_huggingface_token  # Optional, for private model access

Contributing New Workflows

To add a new workflow, follow these steps:

  1. Create a new directory under src/comfy_models/workflows/ with your workflow name
  2. Required files:
workflows/
└── your_workflow_name/
    ├── config.py          # Workflow configuration
    ├── runner.py          # Modal app definition
    ├── workflow.json      # ComfyUI workflow definition
    └── workflow_api.json  # API interface definition

Configuration (config.py)

from comfy_models.base.comfy_utils import Config

config = Config(
    name="your_workflow_name",
    models_to_cache=[
        "path/to/model1.safetensors",
        "path/to/model2.safetensors"
    ],
    warmup_workflow=True,  # Run workflow once on startup
    run_twice=False,       # Run workflow twice for testing
    nodes_to_preload=[]    # Nodes to initialize on startup
)

Runner (runner.py)

import uuid
from comfy_models.base.base_app import _ComfyDeployRunnerModelsDownloadOptimzedImports
import modal
from comfy_models.workflows.shared import get_configs
from comfy_models.workflows.your_workflow_name.config import config

APP_NAME = config.name
app = modal.App(APP_NAME)

@app.cls(
    **get_configs(APP_NAME),
    enable_memory_snapshot=True,
)
class ComfyDeployRunner(_ComfyDeployRunnerModelsDownloadOptimzedImports):
    config = config

@app.local_entrypoint()
def main():
    ComfyDeployRunner().run.remote({
        "prompt_id": str(uuid.uuid4()),
        "inputs": {
            "your_input": "your value"
        },
    })

Workflow Files

  • workflow.json: Export your workflow from ComfyUI
  • workflow_api.json: Define the API interface for your workflow using ComfyDeploy nodes

Example Workflows

Check out existing workflows in the workflows directory for reference:

  • flux_dev: Flux model with development settings
  • flux_schnell: Optimized Flux model
  • sd3_5_large: Stable Diffusion 3.5 large model

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

comfy_models-0.1.3.tar.gz (68.8 kB view details)

Uploaded Source

Built Distribution

comfy_models-0.1.3-py3-none-any.whl (48.3 kB view details)

Uploaded Python 3

File details

Details for the file comfy_models-0.1.3.tar.gz.

File metadata

  • Download URL: comfy_models-0.1.3.tar.gz
  • Upload date:
  • Size: 68.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.29

File hashes

Hashes for comfy_models-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5176d58ad0c203ec77e3de6e7964baddb489c3f5989abac4648742c2d2e4287f
MD5 1b4144fbfdfa82d0a046039c0b7c44a2
BLAKE2b-256 ae68a66a0a123584900d75d8e98b1470cb3ff360732fdaf9e3569c928bab3c3e

See more details on using hashes here.

File details

Details for the file comfy_models-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for comfy_models-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a36164f472904889f4cadd6b37b51b0b4b3ab33db56727da746a90d1226ae069
MD5 67253d1663e4f7e867a5dcaf1432ee3b
BLAKE2b-256 35b57c3d60972aea782f9f68f92889690e2b176945f35b866eebe7abf9915608

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page