Update gradio_app.py
Browse files- gradio_app.py +11 -2
gradio_app.py
CHANGED
@@ -136,9 +136,18 @@ def get_image(image1, prompt, image2, dim_steps=50, ddim_eta=1., fs=None, seed=1
|
|
136 |
transform = transforms.Compose([
|
137 |
transforms.Resize(min(video_size)),
|
138 |
transforms.CenterCrop(video_size),
|
139 |
-
transforms.ToTensor(),
|
140 |
-
transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))]
|
141 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
|
143 |
# image1 = Image.open(file_list[2*idx]).convert('RGB')
|
144 |
image_tensor1 = transform(image1).unsqueeze(1) # [c,1,h,w]
|
|
|
136 |
transform = transforms.Compose([
|
137 |
transforms.Resize(min(video_size)),
|
138 |
transforms.CenterCrop(video_size),
|
139 |
+
# transforms.ToTensor(),
|
140 |
+
# transforms.Normalize(mean=(0.5, 0.5, 0.5), std=(0.5, 0.5, 0.5))]
|
141 |
)
|
142 |
+
|
143 |
+
image1 = torch.from_numpy(image1).permute(2, 0, 1).float().cuda()
|
144 |
+
input_h, input_w = image1.shape[1:]
|
145 |
+
image1 = (image_tensor1 / 255. - 0.5) * 2
|
146 |
+
|
147 |
+
image2 = torch.from_numpy(image2).permute(2, 0, 1).float().cuda()
|
148 |
+
input_h, input_w = image2.shape[1:]
|
149 |
+
image2 = (image2 / 255. - 0.5) * 2
|
150 |
+
|
151 |
|
152 |
# image1 = Image.open(file_list[2*idx]).convert('RGB')
|
153 |
image_tensor1 = transform(image1).unsqueeze(1) # [c,1,h,w]
|