Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,20 +5,16 @@ from diffusers import DiffusionPipeline
|
|
| 5 |
from optimum.intel.openvino import OVStableDiffusionPipeline
|
| 6 |
import torch
|
| 7 |
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
-
if torch.cuda.is_available():
|
| 11 |
-
torch.cuda.max_memory_allocated(device=device)
|
| 12 |
-
pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16", use_safetensors=True)
|
| 13 |
-
pipe.enable_xformers_memory_efficient_attention()
|
| 14 |
-
pipe = pipe.to(device)
|
| 15 |
-
else:
|
| 16 |
-
#pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", use_safetensors=True)
|
| 17 |
-
pipe = OVStableDiffusionPipeline.from_pretrained("helenai/Linaqruf-anything-v3.0-ov")
|
| 18 |
-
pipe = pipe.to(device)
|
| 19 |
|
| 20 |
MAX_SEED = np.iinfo(np.int32).max
|
| 21 |
-
MAX_IMAGE_SIZE =
|
| 22 |
|
| 23 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
| 24 |
|
|
@@ -52,10 +48,8 @@ css="""
|
|
| 52 |
}
|
| 53 |
"""
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
else:
|
| 58 |
-
power_device = "CPU"
|
| 59 |
|
| 60 |
with gr.Blocks(css=css) as demo:
|
| 61 |
|
|
|
|
| 5 |
from optimum.intel.openvino import OVStableDiffusionPipeline
|
| 6 |
import torch
|
| 7 |
|
| 8 |
+
model_id = "helenai/Linaqruf-anything-v3.0-ov"
|
| 9 |
+
|
| 10 |
+
pipe = OVStableDiffusionPipeline.from_pretrained(model_id, compile=False)
|
| 11 |
+
pipe.reshape( batch_size=batch_size, height=height, width=width, num_images_per_prompt=num_images_per_prompt)
|
| 12 |
+
pipe.compile()
|
| 13 |
+
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
MAX_SEED = np.iinfo(np.int32).max
|
| 17 |
+
MAX_IMAGE_SIZE = 256
|
| 18 |
|
| 19 |
def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
|
| 20 |
|
|
|
|
| 48 |
}
|
| 49 |
"""
|
| 50 |
|
| 51 |
+
|
| 52 |
+
power_device = "CPU"
|
|
|
|
|
|
|
| 53 |
|
| 54 |
with gr.Blocks(css=css) as demo:
|
| 55 |
|