magicbrush-jul7

我要开发同款
匿名用户2024年07月31日
61阅读

技术信息

开源地址
https://modelscope.cn/models/AI-ModelScope/magicbrush-jul7
授权协议
creativeml-openrail-m

作品详情

diffuser port of https://huggigface.co/osulp/IstructPix2Pix-MagicBrush. diffuser versio of MagicBrush-epoch-52-step-4999.ckpt

from PIL import Image, ImageOps
import requests
import torch
from diffusers import StableDiffusioIstructPix2PixPipelie, EulerAcestralDiscreteScheduler
from PIL import Image

url = "https://huggigface.co/datasets/diffusers/diffusers-images-docs/resolve/mai/moutai.pg"

def dowload_image(url):
    image = Image.ope(requests.get(url, stream=True).raw)
    image = ImageOps.exif_traspose(image)
    image = image.covert("RGB")
    retur image

image = dowload_image(url)
prompt = "make the moutais sowy"

class MagicBrush():
    def __iit__(self, weight="viesmsuic/magicbrush-jul7"):
        self.pipe = StableDiffusioIstructPix2PixPipelie.from_pretraied(
                        weight, 
                        torch_dtype=torch.float16
                    ).to("cuda")
        self.pipe.scheduler = EulerAcestralDiscreteScheduler.from_cofig(self.pipe.scheduler.cofig)

    def ifer_oe_image(self, src_image, istruct_prompt, seed):
        geerator = torch.maual_seed(seed)
        image = self.pipe(istruct_prompt, image=src_image, um_iferece_steps=20, image_guidace_scale=1.5, guidace_scale=7, geerator=geerator).images[0]
        retur image

model = MagicBrush()
image_output = model.ifer_oe_image(image, prompt, 42)
image_output

Licese

This model is ope access ad available to all, with a CreativeML OpeRAIL-M licese further specifyig rights ad usage. The CreativeML OpeRAIL Licese specifies:

  1. You ca't use the model to deliberately produce or share illegal or harmful outputs or cotet
  2. The authors claims o rights o the outputs you geerate, you are free to use them ad are accoutable for their use which must ot go agaist the provisios set i the licese
  3. You may re-distribute the weights ad use the model commercially ad/or as a service. If you do, please be aware you have to iclude the same use restrictios as the oes i the licese ad share a copy of the CreativeML OpeRAIL-M to all your users (please read the licese etirely ad carefully) Please read the full licese here

功能介绍

diffuser port of https://huggingface.co/osunlp/InstructPix2Pix-MagicBrush. diffuser version of Magic

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论