MegaTronX commited on
Commit
491bb26
·
verified ·
1 Parent(s): 22ede38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  import numpy as np
3
  import random
@@ -10,10 +11,12 @@ from live_preview_helpers import calculate_shift, retrieve_timesteps, flux_pipe_
10
  dtype = torch.bfloat16
11
  device = "cuda" if torch.cuda.is_available() else "cpu"
12
 
 
 
13
  taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
14
  good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=dtype).to(device)
15
- pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=dtype, vae=taef1).to(device)
16
- #pipe.load_lora_weights("MegaTronX/MetartLoRA", weight_name="MetartLoRA.safetensors")
17
  torch.cuda.empty_cache()
18
 
19
  MAX_SEED = np.iinfo(np.int32).max
 
1
+ import os
2
  import gradio as gr
3
  import numpy as np
4
  import random
 
11
  dtype = torch.bfloat16
12
  device = "cuda" if torch.cuda.is_available() else "cpu"
13
 
14
+ token = os.environ.get("HF_TOKEN")
15
+
16
  taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=dtype).to(device)
17
  good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=dtype).to(device)
18
+ pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=dtype, vae=taef1, use_auth_token=token).to(device)
19
+ pipe.load_lora_weights("MegaTronX/MetartLoRA", weight_name="MetartLoRA.safetensors")
20
  torch.cuda.empty_cache()
21
 
22
  MAX_SEED = np.iinfo(np.int32).max