File size: 920 Bytes
43de88c cbfb133 da20627 43de88c da20627 307e9e0 70f0c91 2f425fc 43de88c 307e9e0 cbfb133 70375cc 307e9e0 70375cc 2f425fc 307e9e0 70375cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import torch
import kiui
import numpy as np
import argparse
from mvdream.pipeline_mvdream import MVDreamPipeline
pipe = MVDreamPipeline.from_pretrained(
"./weights_imagedream", # local weights
# "ashawkey/mvdream-sd2.1-diffusers",
torch_dtype=torch.float16
)
pipe = pipe.to("cuda")
parser = argparse.ArgumentParser(description="ImageDream")
parser.add_argument("image", type=str, default='data/anya_rgba.png')
parser.add_argument("--prompt", type=str, default="")
args = parser.parse_args()
for i in range(5):
input_image = kiui.read_image(args.image, mode='float')
image = pipe(args.prompt, input_image, guidance_scale=5)
grid = np.concatenate(
[
np.concatenate([image[0], image[2]], axis=0),
np.concatenate([image[1], image[3]], axis=0),
],
axis=1,
)
# kiui.vis.plot_image(grid)
kiui.write_image(f'test_imagedream_{i}.jpg', grid)
|