AkashKumarave commited on
Commit
b3b7a4f
·
verified ·
1 Parent(s): fcd5758

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -54,6 +54,20 @@ ip_adapter_weights = download_file(
54
  subfolder="models"
55
  )
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Load Stable Diffusion 1.5
58
  logger.info("Loading Stable Diffusion 1.5 base model...")
59
  pipe = StableDiffusionPipeline.from_pretrained(
@@ -67,13 +81,13 @@ pipe = StableDiffusionPipeline.from_pretrained(
67
  )
68
  logger.info("SD 1.5 base model loaded successfully.")
69
 
70
- # Load IP-Adapter with CLIP Vision model
71
  logger.info("Loading h94 IP-Adapter with CLIP Vision model...")
72
- pipe.load_ip_adapter(
73
- "openai/clip-vit-large-patch14", # CLIP Vision model repo only
74
- subfolder="" # No weights specified here
 
75
  )
76
- pipe.load_ip_adapter_weights(ip_adapter_dir, weight_name="ip-adapter_sd15.bin") # Load local weights
77
  logger.info("h94 IP-Adapter weights loaded successfully.")
78
 
79
  # Move pipeline to CPU
 
54
  subfolder="models"
55
  )
56
 
57
+ # Download CLIP Vision model files
58
+ logger.info("Downloading CLIP Vision model files...")
59
+ clip_dir = "./clip_model"
60
+ download_file(
61
+ "openai/clip-vit-large-patch14",
62
+ "config.json",
63
+ clip_dir
64
+ )
65
+ download_file(
66
+ "openai/clip-vit-large-patch14",
67
+ "model.fp16.safetensors",
68
+ clip_dir
69
+ )
70
+
71
  # Load Stable Diffusion 1.5
72
  logger.info("Loading Stable Diffusion 1.5 base model...")
73
  pipe = StableDiffusionPipeline.from_pretrained(
 
81
  )
82
  logger.info("SD 1.5 base model loaded successfully.")
83
 
84
+ # Load IP-Adapter weights directly
85
  logger.info("Loading h94 IP-Adapter with CLIP Vision model...")
86
+ pipe.load_ip_adapter_weights(
87
+ ip_adapter_dir, # Local IP-Adapter weights directory
88
+ weight_name="ip-adapter_sd15.bin",
89
+ image_encoder_folder=clip_dir # Local CLIP Vision model directory
90
  )
 
91
  logger.info("h94 IP-Adapter weights loaded successfully.")
92
 
93
  # Move pipeline to CPU