michaelj commited on
Commit
bfc8304
1 Parent(s): 1be6eac
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -13,8 +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 = OVStableDiffusionImg2ImgPipeline.from_pretrained("Lykon/dreamshaper-xl-lightning", 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(
20
  # cache_interval=3,
@@ -28,7 +27,9 @@ def resize(value,img):
28
  img = img.resize((value,value))
29
  return img
30
 
31
- def infer(source_img, prompt, steps, seed, Strength):
 
 
32
  start_time = time.time()
33
  generator = torch.Generator(device).manual_seed(seed)
34
  if int(steps * Strength) < 1:
@@ -42,6 +43,7 @@ def infer(source_img, prompt, steps, seed, Strength):
42
  return image
43
 
44
  gr.Interface(fn=infer, inputs=[
 
45
  gr.Image(sources=["upload", "webcam", "clipboard"], type="filepath", label="Raw Image."),
46
  gr.Textbox(label = 'Prompt Input Text. 77 Token (Keyword or Symbol) Maximum'),
47
  gr.Slider(1, 5, value = 2, step = 1, label = 'Number of Iterations'),
 
13
  adapter_id = "latent-consistency/lcm-lora-sdv1-5"
14
 
15
  device = "cuda" if torch.cuda.is_available() else "cpu"
16
+
 
17
  # helper = DeepCacheSDHelper(pipe=pipe)
18
  # helper.set_params(
19
  # cache_interval=3,
 
27
  img = img.resize((value,value))
28
  return img
29
 
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
  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'),