Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
bde7aa3
1
Parent(s):
673064b
feat: Add authentication token support for Flux and CatVTON pipelines in app.py
Browse files- Integrated the use of an authentication token for accessing Hugging Face models in the FluxTryOnPipeline and CatVTONPix2PixPipeline.
- Updated the model loading functions to include `use_auth_token` parameter, enhancing security and access control for model repositories.
app.py
CHANGED
@@ -137,8 +137,9 @@ automasker = AutoMasker(
|
|
137 |
|
138 |
|
139 |
# Flux-based CatVTON
|
|
|
140 |
flux_repo = "black-forest-labs/FLUX.1-Fill-dev"
|
141 |
-
pipeline_flux = FluxTryOnPipeline.from_pretrained(flux_repo)
|
142 |
pipeline_flux.load_lora_weights(
|
143 |
os.path.join(repo_path, "flux-lora"),
|
144 |
weight_name='pytorch_lora_weights.safetensors'
|
@@ -148,7 +149,7 @@ pipeline_flux.to("cuda", init_weight_dtype(args.mixed_precision))
|
|
148 |
|
149 |
# Mask-free CatVTON
|
150 |
catvton_mf_repo = "zhengchong/CatVTON-MaskFree"
|
151 |
-
repo_path_mf = snapshot_download(repo_id=catvton_mf_repo)
|
152 |
pipeline_p2p = CatVTONPix2PixPipeline(
|
153 |
base_ckpt=args.p2p_base_model_path,
|
154 |
attn_ckpt=repo_path_mf,
|
|
|
137 |
|
138 |
|
139 |
# Flux-based CatVTON
|
140 |
+
access_token = os.getenv("HUGGING_FACE_HUB_TOKEN")
|
141 |
flux_repo = "black-forest-labs/FLUX.1-Fill-dev"
|
142 |
+
pipeline_flux = FluxTryOnPipeline.from_pretrained(flux_repo, use_auth_token=access_token)
|
143 |
pipeline_flux.load_lora_weights(
|
144 |
os.path.join(repo_path, "flux-lora"),
|
145 |
weight_name='pytorch_lora_weights.safetensors'
|
|
|
149 |
|
150 |
# Mask-free CatVTON
|
151 |
catvton_mf_repo = "zhengchong/CatVTON-MaskFree"
|
152 |
+
repo_path_mf = snapshot_download(repo_id=catvton_mf_repo, use_auth_token=access_token)
|
153 |
pipeline_p2p = CatVTONPix2PixPipeline(
|
154 |
base_ckpt=args.p2p_base_model_path,
|
155 |
attn_ckpt=repo_path_mf,
|