DarianT commited on
Commit
ec285c2
·
1 Parent(s): ee68e13

Remove unnecessary loading of LoRA weights

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -31,6 +31,9 @@ gender_dict = {"ID_1": "male", "ID_5": "male", "ID_16": "female", "ID_20": "male
31
  MAX_SEED = 10000
32
  image_size = 512
33
 
 
 
 
34
  @spaces.GPU # Uncomment if using ZeroGPU
35
  def infer(
36
  identity,
@@ -45,9 +48,11 @@ def infer(
45
  num_images=1
46
  ):
47
 
48
- full_lora_weights_path = f"{folder_of_lora_weights}/{identity}/{which_checkpoint}/{lora_name}"
49
- pipe.load_lora_weights(full_lora_weights_path)
50
-
 
 
51
  if randomize_seed:
52
  seed = random.randint(0, MAX_SEED)
53
 
 
31
  MAX_SEED = 10000
32
  image_size = 512
33
 
34
+
35
+ previous_id = ""
36
+
37
  @spaces.GPU # Uncomment if using ZeroGPU
38
  def infer(
39
  identity,
 
48
  num_images=1
49
  ):
50
 
51
+ if identity != previous_id:
52
+ full_lora_weights_path = f"{folder_of_lora_weights}/{identity}/{which_checkpoint}/{lora_name}"
53
+ pipe.load_lora_weights(full_lora_weights_path)
54
+ previous_id = identity
55
+
56
  if randomize_seed:
57
  seed = random.randint(0, MAX_SEED)
58