Spaces:
Sleeping
Sleeping
| import torch | |
| from optimum.intel import OVZImagePipeline | |
| # ===== Load once ===== | |
| pipe = OVZImagePipeline.from_pretrained( | |
| "hsuwill000/Z-Image-Turbo-ov", | |
| device="cpu" | |
| ) | |
| def generate( | |
| prompt, | |
| height=512, | |
| width=512, | |
| steps=9, | |
| seed=-1, | |
| ): | |
| if seed == -1: | |
| generator = torch.Generator("cpu") | |
| else: | |
| generator = torch.Generator("cpu").manual_seed(int(seed)) | |
| image = pipe( | |
| prompt=prompt, | |
| height=int(height), | |
| width=int(width), | |
| num_inference_steps=int(steps), | |
| guidance_scale=0.0, | |
| generator=generator, | |
| ).images[0] | |
| return image |