multimodalart HF staff commited on
Commit
9264260
1 Parent(s): ae20f61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -8,26 +8,32 @@ import os
8
  from pipeline_flux_ipa import FluxPipeline
9
  from transformer_flux import FluxTransformer2DModel
10
  from attention_processor import IPAFluxAttnProcessor2_0
 
 
 
 
11
  from transformers import AutoProcessor, SiglipVisionModel
12
  from infer_flux_ipa_siglip import MLPProjModel, IPAdapter
13
  from huggingface_hub import hf_hub_download
14
 
 
15
  # Constants
16
  MAX_SEED = np.iinfo(np.int32).max
17
  MAX_IMAGE_SIZE = 1024
18
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
19
 
 
20
  image_encoder_path = "google/siglip-so400m-patch14-384"
21
- ipadapter_path = hf_hub_download(repo_id="InstantX/FLUX.1-dev-IP-Adapter", filename="ip-adapter.bin")
22
 
23
- transformer = FluxTransformer2DModel.from_pretrained(
24
- "black-forest-labs/FLUX.1-dev",
25
  subfolder="transformer",
26
  torch_dtype=torch.bfloat16
27
  )
28
 
29
  pipe = FluxPipeline.from_pretrained(
30
- "black-forest-labs/FLUX.1-dev",
31
  transformer=transformer,
32
  torch_dtype=torch.bfloat16
33
  )
@@ -88,7 +94,7 @@ css = """
88
  # Create the Gradio interface
89
  with gr.Blocks(css=css) as demo:
90
  with gr.Column(elem_id="col-container"):
91
- gr.Markdown("# InstantX's FLUX.1-dev-IP-Adapter")
92
 
93
  with gr.Row():
94
  with gr.Column():
 
8
  from pipeline_flux_ipa import FluxPipeline
9
  from transformer_flux import FluxTransformer2DModel
10
  from attention_processor import IPAFluxAttnProcessor2_0
11
+
12
+ from models.transformer_sd3 import SD3Transformer2DModel
13
+ from pipeline_stable_diffusion_3_ipa import StableDiffusion3Pipeline
14
+
15
  from transformers import AutoProcessor, SiglipVisionModel
16
  from infer_flux_ipa_siglip import MLPProjModel, IPAdapter
17
  from huggingface_hub import hf_hub_download
18
 
19
+
20
  # Constants
21
  MAX_SEED = np.iinfo(np.int32).max
22
  MAX_IMAGE_SIZE = 1024
23
  DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
24
 
25
+ model_path = 'stabilityai/stable-diffusion-3.5-large'
26
  image_encoder_path = "google/siglip-so400m-patch14-384"
27
+ ipadapter_path = hf_hub_download(repo_id="InstantX/SD3.5-Large-IP-Adapter", filename="ip-adapter.bin")
28
 
29
+ transformer = SD3Transformer2DModel.from_pretrained(
30
+ model_path,
31
  subfolder="transformer",
32
  torch_dtype=torch.bfloat16
33
  )
34
 
35
  pipe = FluxPipeline.from_pretrained(
36
+ model_path,
37
  transformer=transformer,
38
  torch_dtype=torch.bfloat16
39
  )
 
94
  # Create the Gradio interface
95
  with gr.Blocks(css=css) as demo:
96
  with gr.Column(elem_id="col-container"):
97
+ gr.Markdown("# InstantX's SD3.5 IP Adapter")
98
 
99
  with gr.Row():
100
  with gr.Column():