-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdemo_i2p.py
More file actions
20 lines (15 loc) · 767 Bytes
/
demo_i2p.py
File metadata and controls
20 lines (15 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import torch
from diffusers.utils import load_image
from img2panoimg import Image2360PanoramaImagePipeline
image = load_image("./data/i2p-image.jpg").resize((512, 512))
mask = load_image("./data/i2p-mask.jpg")
prompt = 'The office room'
# for <16GB gpu
input = {'prompt': prompt, 'image': image, 'mask': mask, 'upscale': False}
# for >16GB gpu (24GB at least)
# the similarity with the input image is poor because of the super-resolution steps. It should be improved.
# input = {'prompt': prompt, 'image': image, 'mask': mask, 'upscale': True}
model_id = '/data/projects/test/cv_diffusion_text-to-360panorama-image_generation'
img2panoimg = Image2360PanoramaImagePipeline(model_id, torch_dtype=torch.float16)
output = img2panoimg(input)
output.save('result.png')