Instructions to use mhnakif/comfy2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use mhnakif/comfy2 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("mhnakif/comfy2", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
| from pydantic import BaseModel, Field | |
| class CreateSwitchXRequest(BaseModel): | |
| generation_type: str = Field(...) | |
| source_uri: str = Field(...) | |
| alpha_mode: str = Field(...) | |
| prompt: str | None = Field(None, max_length=2000) | |
| reference_image_uri: str | None = Field(None) | |
| alpha_uri: str | None = Field(None) | |
| max_resolution: int = Field(1080) | |
| callback_url: str | None = Field(None) | |
| idempotency_key: str | None = Field(None, max_length=256, min_length=1) | |
| class SwitchXOutputUrls(BaseModel): | |
| render: str | None = Field(None) | |
| source: str | None = Field(None) | |
| alpha: str | None = Field(None) | |
| class SwitchXStatusResponse(BaseModel): | |
| id: str = Field(...) | |
| status: str = Field(...) | |
| progress: int | None = Field(None) | |
| generation_type: str | None = Field(None) | |
| alpha_mode: str | None = Field(None) | |
| output: SwitchXOutputUrls | None = Field(None) | |
| error: str | None = Field(None) | |
| created_at: str | None = Field(None) | |
| modified_at: str | None = Field(None) | |
| completed_at: str | None = Field(None) | |