michaelj commited on
Commit
c883d1e
1 Parent(s): 6876a86

scheduling_tcd

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -9,6 +9,7 @@ from diffusers import AutoPipelineForImage2Image
9
  from diffusers.utils import load_image
10
  import math
11
  from DeepCache import DeepCacheSDHelper
 
12
 
13
  adapter_id = "latent-consistency/lcm-lora-sdv1-5"
14
 
@@ -30,6 +31,10 @@ def resize(value,img):
30
  def infer(model_id,source_img, prompt, steps, seed, Strength):
31
  pipe = OVStableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16, export=True) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo")
32
  pipe = pipe.to(device)
 
 
 
 
33
  start_time = time.time()
34
  generator = torch.Generator(device).manual_seed(seed)
35
  if int(steps * Strength) < 1:
@@ -43,7 +48,7 @@ def infer(model_id,source_img, prompt, steps, seed, Strength):
43
  return image
44
 
45
  gr.Interface(fn=infer, inputs=[
46
- gr.Text(value="Lykon/dreamshaper-8", label="Checkpoint"),
47
  gr.Image(sources=["upload", "webcam", "clipboard"], type="filepath", label="Raw Image."),
48
  gr.Textbox(label = 'Prompt Input Text. 77 Token (Keyword or Symbol) Maximum'),
49
  gr.Slider(1, 5, value = 2, step = 1, label = 'Number of Iterations'),
 
9
  from diffusers.utils import load_image
10
  import math
11
  from DeepCache import DeepCacheSDHelper
12
+ from scheduling_tcd import TCDScheduler
13
 
14
  adapter_id = "latent-consistency/lcm-lora-sdv1-5"
15
 
 
31
  def infer(model_id,source_img, prompt, steps, seed, Strength):
32
  pipe = OVStableDiffusionImg2ImgPipeline.from_pretrained(model_id, torch_dtype=torch.float16, export=True) if torch.cuda.is_available() else AutoPipelineForImage2Image.from_pretrained("stabilityai/sdxl-turbo")
33
  pipe = pipe.to(device)
34
+ pipe.scheduler = TCDScheduler.from_config(pipe.scheduler.config)
35
+ tcd_lora_id = "h1t/TCD-SDXL-LoRA"
36
+ pipe.load_lora_weights(tcd_lora_id)
37
+ pipe.fuse_lora()
38
  start_time = time.time()
39
  generator = torch.Generator(device).manual_seed(seed)
40
  if int(steps * Strength) < 1:
 
48
  return image
49
 
50
  gr.Interface(fn=infer, inputs=[
51
+ gr.Text(value="Lykon/dreamshaper-xl-v2-turbo", label="Checkpoint"),
52
  gr.Image(sources=["upload", "webcam", "clipboard"], type="filepath", label="Raw Image."),
53
  gr.Textbox(label = 'Prompt Input Text. 77 Token (Keyword or Symbol) Maximum'),
54
  gr.Slider(1, 5, value = 2, step = 1, label = 'Number of Iterations'),