Spaces:
Runtime error
Runtime error
patrickvonplaten
commited on
Commit
β’
a01639c
1
Parent(s):
13d077a
fix more
Browse filesFormer-commit-id: 239ed0fd0247807df4f62e5dc22dfe00f6e14db3
- scripts/txt2img.py +1 -6
scripts/txt2img.py
CHANGED
@@ -266,7 +266,7 @@ def main():
|
|
266 |
|
267 |
x_samples_ddim = model.decode_first_stage(samples_ddim)
|
268 |
x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0)
|
269 |
-
x_samples_ddim = x_samples_ddim.cpu().permute(0, 2, 3, 1)
|
270 |
|
271 |
x_image = x_samples_ddim
|
272 |
safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
|
@@ -295,11 +295,6 @@ def main():
|
|
295 |
Image.fromarray(grid.astype(np.uint8)).save(os.path.join(outpath, f'grid-{grid_count:04}.png'))
|
296 |
grid_count += 1
|
297 |
|
298 |
-
image = x_samples_ddim.cpu().permute(0, 2, 3, 1).numpy()
|
299 |
-
|
300 |
-
# run safety checker
|
301 |
-
safety_checker_input = pipe.feature_extractor(numpy_to_pil(image), return_tensors="pt")
|
302 |
-
image, has_nsfw_concept = pipe.safety_checker(images=image, clip_input=safety_checker_input.pixel_values)
|
303 |
toc = time.time()
|
304 |
|
305 |
print(f"Your samples are ready and waiting for you here: \n{outpath} \n"
|
|
|
266 |
|
267 |
x_samples_ddim = model.decode_first_stage(samples_ddim)
|
268 |
x_samples_ddim = torch.clamp((x_samples_ddim + 1.0) / 2.0, min=0.0, max=1.0)
|
269 |
+
x_samples_ddim = x_samples_ddim.cpu().permute(0, 2, 3, 1)
|
270 |
|
271 |
x_image = x_samples_ddim
|
272 |
safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
|
|
|
295 |
Image.fromarray(grid.astype(np.uint8)).save(os.path.join(outpath, f'grid-{grid_count:04}.png'))
|
296 |
grid_count += 1
|
297 |
|
|
|
|
|
|
|
|
|
|
|
298 |
toc = time.time()
|
299 |
|
300 |
print(f"Your samples are ready and waiting for you here: \n{outpath} \n"
|