ar0551 commited on
Commit
740ed8c
·
verified ·
1 Parent(s): 72b4d00

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -35,25 +35,24 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
35
  )
36
 
37
  # Load lora (giving it a name makes it active when using the name in the prompt)
38
- pipe.load_lora_weights("ostris/ikea-instructions-lora-sdxl", weight_name="ikea_instructions_xl_v1_5.safetensors", adapter_name="ikea")
39
- pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors", adapter_name="pixel")
40
- pipe.load_lora_weights('e-n-v-y/envy-junkworld-xl-01', weight_name='EnvyJunkworldXL01.safetensors', adapter_name="junkworld")
41
- pipe.disable_lora()
42
 
43
  def activate_ikea_lora():
44
  print("Activating IKEA LoRa")
45
- pipe.disable_lora()
46
- while pipe.get_active_adapters()[0] != "ikea":
47
- pipe.enable_lora()
48
- pipe.set_adapters("ikea")
49
  print("IKEA LoRa active!")
50
 
51
  def activate_pixel_lora():
52
  print("Activating PixelArt LoRa")
53
- pipe.disable_lora()
54
- while pipe.get_active_adapters()[0] != "pixel":
55
- pipe.enable_lora()
56
- pipe.set_adapters("pixel")
57
  print("PixelArt LoRa active!")
58
 
59
  def activate_junkworld_lora():
@@ -66,8 +65,8 @@ def activate_junkworld_lora():
66
 
67
  def disable_loras():
68
  print("Deactivating LoRas")
69
- while len(pipe.get_active_adapters()) > 0:
70
- pipe.disable_lora()
71
  print("All LoRas deactivated!")
72
 
73
  pipe.to(device)
 
35
  )
36
 
37
  # Load lora (giving it a name makes it active when using the name in the prompt)
38
+ #pipe.load_lora_weights("ostris/ikea-instructions-lora-sdxl", weight_name="ikea_instructions_xl_v1_5.safetensors", adapter_name="ikea")
39
+ #pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors", adapter_name="pixel")
40
+ #pipe.load_lora_weights('e-n-v-y/envy-junkworld-xl-01', weight_name='EnvyJunkworldXL01.safetensors', adapter_name="junkworld")
 
41
 
42
  def activate_ikea_lora():
43
  print("Activating IKEA LoRa")
44
+ for adapter in pipe.get_active_adapters():
45
+ pipe.delete_adapters(adapter)
46
+ pipe.load_lora_weights("ostris/ikea-instructions-lora-sdxl", weight_name="ikea_instructions_xl_v1_5.safetensors", adapter_name="ikea")
47
+ pipe.set_adapters("ikea")
48
  print("IKEA LoRa active!")
49
 
50
  def activate_pixel_lora():
51
  print("Activating PixelArt LoRa")
52
+ for adapter in pipe.get_active_adapters():
53
+ pipe.delete_adapters(adapter)
54
+ pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors", adapter_name="pixel")
55
+ pipe.set_adapters("pixel")
56
  print("PixelArt LoRa active!")
57
 
58
  def activate_junkworld_lora():
 
65
 
66
  def disable_loras():
67
  print("Deactivating LoRas")
68
+ for adapter in pipe.get_active_adapters():
69
+ pipe.delete_adapters(adapter)
70
  print("All LoRas deactivated!")
71
 
72
  pipe.to(device)