Downloads · 30 days
8
0% of all-time downloads
vinesmsuic/magicbrush-paper
magicbrush-paper is a text-to-image model from vinesmsuic. Use it when you need an image from a text prompt. It is set up for diffusers. The card lists the license as creativeml-openrail-m.
diffuser port of https://huggingface.co/osunlp/InstructPix2Pix-MagicBrush. diffuser version of MagicBrush-epoch-000168.ckpt
Downloads · 30 days
8
0% of all-time downloads
All-time downloads
16.6K
Public
Repo size
5.5 GB
Likes
2
Public
Click a slice to open those files.
.bin5.5 GB · 100%
From the Hugging Face model README
diffuser port of https://huggingface.co/osunlp/InstructPix2Pix-MagicBrush.
diffuser version of MagicBrush-epoch-000168.ckpt
from PIL import Image, ImageOps
import requests
import torch
from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler
from PIL import Image
url = "https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
def download_image(url):
image = Image.open(requests.get(url, stream=True).raw)
image = ImageOps.exif_transpose(image)
image = image.convert("RGB")
return image
image = download_image(url)
prompt = "make the mountains snowy"
class MagicBrush():
def __init__(self, weight="vinesmsuic/magicbrush-paper"):
self.pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
weight,
torch_dtype=torch.float16
).to("cuda")
self.pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(self.pipe.scheduler.config)
def infer_one_image(self, src_image, instruct_prompt, seed):
generator = torch.manual_seed(seed)
image = self.pipe(instruct_prompt, image=src_image, num_inference_steps=20, image_guidance_scale=1.5, guidance_scale=7, generator=generator).images[0]
return image
model = MagicBrush()
image_output = model.infer_one_image(image, prompt, 42)
image_output

This model is open access and available to all, with a CreativeML OpenRAIL-M license further specifying rights and usage. The CreativeML OpenRAIL License specifies: