ar0551 commited on
Commit
4c346fd
·
verified ·
1 Parent(s): 7453942

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -16
app.py CHANGED
@@ -35,40 +35,35 @@ 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
 
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
- pipe.to(device)
49
  print("IKEA LoRa active!")
50
 
51
  def activate_pixel_lora():
52
  print("Activating PixelArt LoRa")
53
- for adapter in pipe.get_active_adapters():
54
- pipe.delete_adapters(adapter)
55
- pipe.load_lora_weights("nerijs/pixel-art-xl", weight_name="pixel-art-xl.safetensors", adapter_name="pixel")
56
- pipe.set_adapters("pixel")
57
- pipe.to(device)
58
  print("PixelArt LoRa active!")
59
 
60
  def activate_junkworld_lora():
61
  print("Activating JunkWorld LoRa")
62
  pipe.disable_lora()
63
  while pipe.get_active_adapters()[0] != "junkworld":
64
- pipe.enable_lora()
65
  pipe.set_adapters("junkworld")
66
  print("JunkWorld LoRa active!")
67
 
68
  def disable_loras():
69
  print("Deactivating LoRas")
70
- for adapter in pipe.get_active_adapters():
71
- pipe.delete_adapters(adapter)
72
  print("All LoRas deactivated!")
73
 
74
  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
+ pipe.disable_lora()
45
+ while pipe.get_active_adapters()[0] != "ikea":
46
+ pipe.set_adapters("ikea")
 
 
47
  print("IKEA LoRa active!")
48
 
49
  def activate_pixel_lora():
50
  print("Activating PixelArt LoRa")
51
+ pipe.disable_lora()
52
+ while pipe.get_active_adapters()[0] != "pixel":
53
+ pipe.set_adapters("pixel")
 
 
54
  print("PixelArt LoRa active!")
55
 
56
  def activate_junkworld_lora():
57
  print("Activating JunkWorld LoRa")
58
  pipe.disable_lora()
59
  while pipe.get_active_adapters()[0] != "junkworld":
 
60
  pipe.set_adapters("junkworld")
61
  print("JunkWorld LoRa active!")
62
 
63
  def disable_loras():
64
  print("Deactivating LoRas")
65
+ while len(pipe.get_active_adapters()) > 0:
66
+ pipe.disable_lora()
67
  print("All LoRas deactivated!")
68
 
69
  pipe.to(device)