MegaTronX commited on
Commit
6d0c42b
Β·
verified Β·
1 Parent(s): 5aecc9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -8,12 +8,20 @@ import random
8
  import spaces
9
 
10
  # Constants
11
- BASE_MODEL = "black-forest-labs/FLUX.1-dev"
12
- LORA_MODEL = "MegaTronX/SuicideGirl-FLUX" # Replace with your LoRA path
13
  MAX_SEED = np.iinfo(np.int32).max
14
 
 
 
 
 
 
 
 
 
15
  # Initialize model and scheduler
16
- if torch.cuda.is_available():
17
  transformer = FluxTransformer2DModel.from_single_file(
18
  "https://huggingface.co/MegaTronX/SuicideGirl-FLUX/blob/main/SuicideGirls.safetensors",
19
  torch_dtype=torch.bfloat16
@@ -30,6 +38,8 @@ if torch.cuda.is_available():
30
 
31
  # Load and apply LoRA weights
32
  pipe.load_lora_weights(LORA_MODEL)
 
 
33
 
34
  @spaces.GPU
35
  def generate_image(
 
8
  import spaces
9
 
10
  # Constants
11
+ #BASE_MODEL = "black-forest-labs/FLUX.1-dev"
12
+ #LORA_MODEL = "MegaTronX/SuicideGirl-FLUX" # Replace with your LoRA path
13
  MAX_SEED = np.iinfo(np.int32).max
14
 
15
+
16
+
17
+ pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
18
+ pipe.load_lora_weights("MegaTronX/SuicideGirl-FLUX", weight_name="SuicideGirls.safetensors")
19
+ pipe.fuse_lora(lora_scale=0.8)
20
+ pipe.to("cuda")
21
+
22
+
23
  # Initialize model and scheduler
24
+ '''if torch.cuda.is_available():
25
  transformer = FluxTransformer2DModel.from_single_file(
26
  "https://huggingface.co/MegaTronX/SuicideGirl-FLUX/blob/main/SuicideGirls.safetensors",
27
  torch_dtype=torch.bfloat16
 
38
 
39
  # Load and apply LoRA weights
40
  pipe.load_lora_weights(LORA_MODEL)
41
+ '''
42
+
43
 
44
  @spaces.GPU
45
  def generate_image(