Render a text prompt's content in a reference image's style, using Krea 2 in 🧨 diffusers — no training, no LoRA.
This is a port of Untwisting RoPE: Frequency Control for Shared Attention in
DiTs
(ComfyUI original) to
the diffusers Krea2Pipeline.
Render a text prompt's content in a reference image's style, using Krea 2 in 🧨 diffusers — no training, no LoRA.
This is a port of Untwisting RoPE: Frequency Control for Shared Attention in
DiTs
(ComfyUI original) to
the diffusers Krea2Pipeline.
| #!/usr/bin/env bash | |
| # Get your shell ready to build Hugging Face Spaces with a coding agent. | |
| # | |
| # Usage: | |
| # curl -LsSf https://<your-gist-url>/gist-setup.sh | bash | |
| # | |
| # Or download, read, then `bash gist-setup.sh`. | |
| # | |
| # Idempotent: re-running is safe — each step skips itself if already done. | |
| # |
| --- | |
| name: huggingface-spaces | |
| description: Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging, buckets, inference providers, community grants. Use whenever the user asks to create or host an app on Hugging Face, port code onto ZeroGPU, fix a Space that won't build or run, or otherwise work with `hf spaces …`, `@spaces.GPU`, Space README frontmatter, or the `spaces` Python package. | |
| --- | |
| # Hugging Face Spaces | |
| Hugging Face Spaces host machine-learning applications. There are 1M+ today; each Space is a git repo. This skill covers creating, building, debugging, and maintaining them. | |
| ## 0. Getting ready |
| import os | |
| import random | |
| import sys | |
| from typing import Sequence, Mapping, Any, Union | |
| import torch | |
| import gradio as gr | |
| from huggingface_hub import hf_hub_download | |
| import spaces | |
| from comfy import model_management |
| # Script for converting a HF Diffusers trained SDXL LoRAs (be it in the old, new or PEFT format) | |
| # To the Kohya format used by some WebUIs such as AUTOMATIC1111, ComfyUI, SD.Next and others. | |
| import argparse | |
| import os | |
| import torch | |
| from safetensors.torch import load_file, save_file | |
| from diffusers.utils import convert_state_dict_to_peft, convert_unet_state_dict_to_peft |