美学提升 - Kontext 图像编辑 LoRA
模型介绍
本 LoRA 模型是基于 Kontext 模型和 DiffSynth-Studio 训练的 LoRA 模型,使用本模型后,可输入指令 Enhance the aesthetic quality of this image. 增强图像的美学质量。模型会自动根据画面内容判断光照、构图等方面的调整,使其更美观。 这个模型可以重复使用,也就是对美学增强后的图再次进行美学增强。
模型效果
| 样例 1 | 样例 2 | 样例 3 | |
|---|---|---|---|
| 原图 | ![]() |
![]() |
![]() |
| 第1次美学增强 | ![]() |
![]() |
![]() |
| 第2次美学增强 | ![]() |
![]() |
![]() |
| 第3次美学增强 | ![]() |
![]() |
![]() |
| 样例 4 | 样例 5 | 样例 6 | |
|---|---|---|---|
| 原图 | ![]() |
![]() |
![]() |
| 第1次美学增强 | ![]() |
![]() |
![]() |
| 第2次美学增强 | ![]() |
![]() |
![]() |
| 第3次美学增强 | ![]() |
![]() |
![]() |
使用说明
本模型基于框架 DiffSynth-Studio 训练,请先安装
git clone https://github.com/modelscope/DiffSynth-Studio.git
cd DiffSynth-Studio
pip install -e .
import torch
from diffsynth.pipelines.flux_image_new import FluxImagePipeline, ModelConfig
from PIL import Image
from modelscope import snapshot_download
snapshot_download("DiffSynth-Studio/FLUX.1-Kontext-dev-lora-ArtAug", cache_dir="./models")
pipe = FluxImagePipeline.from_pretrained(
torch_dtype=torch.bfloat16,
device="cuda",
model_configs=[
ModelConfig(model_id="black-forest-labs/FLUX.1-Kontext-dev", origin_file_pattern="flux1-kontext-dev.safetensors"),
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder/model.safetensors"),
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="text_encoder_2/"),
ModelConfig(model_id="black-forest-labs/FLUX.1-dev", origin_file_pattern="ae.safetensors"),
],
)
pipe.load_lora(pipe.dit, "models/DiffSynth-Studio/FLUX.1-Kontext-dev-lora-ArtAug/model.safetensors", alpha=1)
image = Image.open("your_image.jpg")
image = pipe(
prompt="Enhance the aesthetic quality of this image.",
kontext_images=image,
embedded_guidance=2.5,
seed=0,
)
image.save("output.jpg")























