michaelj commited on
Commit
1d1d7bc
1 Parent(s): fdefdff

OVStableDiffusionXLPipeline

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import modin.pandas as pd
3
  import torch
4
  import time
5
-
6
  import numpy as np
7
  from PIL import Image
8
  from diffusers import AutoPipelineForImage2Image
@@ -13,7 +13,7 @@ from DeepCache import DeepCacheSDHelper
13
  adapter_id = "latent-consistency/lcm-lora-sdv1-5"
14
 
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
- pipe = AutoPipelineForImage2Image.from_pretrained("Lykon/dreamshaper-xl-v2-turbo", torch_dtype=torch.float16) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo")
17
  pipe = pipe.to(device)
18
  # helper = DeepCacheSDHelper(pipe=pipe)
19
  # helper.set_params(
@@ -21,6 +21,8 @@ pipe = pipe.to(device)
21
  # cache_branch_id=0,
22
  # )
23
  # helper.enable()
 
 
24
  def resize(value,img):
25
  img = Image.open(img)
26
  img = img.resize((value,value))
 
2
  import modin.pandas as pd
3
  import torch
4
  import time
5
+ from optimum.intel import OVStableDiffusionXLPipeline
6
  import numpy as np
7
  from PIL import Image
8
  from diffusers import AutoPipelineForImage2Image
 
13
  adapter_id = "latent-consistency/lcm-lora-sdv1-5"
14
 
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
+ pipe = OVStableDiffusionXLPipeline.from_pretrained("Lykon/dreamshaper-xl-v2-turbo", torch_dtype=torch.float16, export=True) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo")
17
  pipe = pipe.to(device)
18
  # helper = DeepCacheSDHelper(pipe=pipe)
19
  # helper.set_params(
 
21
  # cache_branch_id=0,
22
  # )
23
  # helper.enable()
24
+ pipe.compile()
25
+
26
  def resize(value,img):
27
  img = Image.open(img)
28
  img = img.resize((value,value))