()
| 280 | |
| 281 | |
| 282 | def main(): |
| 283 | # Run a demo |
| 284 | model_id = "stabilityai/stable-diffusion-x4-upscaler" |
| 285 | pipe = StableDiffusionTiledUpscalePipeline.from_pretrained(model_id, variant="fp16", torch_dtype=torch.float16) |
| 286 | pipe = pipe.to("cuda") |
| 287 | image = Image.open("../../docs/source/imgs/diffusers_library.jpg") |
| 288 | |
| 289 | def callback(obj): |
| 290 | print(f"progress: {obj['progress']:.4f}") |
| 291 | obj["image"].save("diffusers_library_progress.jpg") |
| 292 | |
| 293 | final_image = pipe(image=image, prompt="Black font, white background, vector", noise_level=40, callback=callback) |
| 294 | final_image.save("diffusers_library.jpg") |
| 295 | |
| 296 | |
| 297 | if __name__ == "__main__": |
no test coverage detected