AkashKumarave commited on
Commit
bd44cb3
·
verified ·
1 Parent(s): 4932f9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -91,14 +91,15 @@ if not os.path.exists(ip_adapter_weights):
91
  # Initialize model with empty weights
92
  with init_empty_weights():
93
  pipe = StableDiffusionXLPipeline.from_pretrained(
94
- "Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",
95
  torch_dtype=dtype,
96
  safety_checker=None,
 
97
  )
98
 
99
  # Load and dispatch model with accelerate
100
  pipe = load_checkpoint_and_dispatch(pipe, model_path, device_map="cpu", offload_folder=None)
101
- pipe.load_ip_adapter("Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus", subfolder=None, weight_name="ipa-faceid-plus.bin")
102
 
103
  def generate_image(uploaded_image, prompt):
104
  img = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
@@ -130,4 +131,4 @@ interface = gr.Interface(
130
  description="Upload an image with a face, enter a prompt, and generate a new image preserving the reference face."
131
  )
132
 
133
- interface.launch()
 
91
  # Initialize model with empty weights
92
  with init_empty_weights():
93
  pipe = StableDiffusionXLPipeline.from_pretrained(
94
+ "./", # Use local model path
95
  torch_dtype=dtype,
96
  safety_checker=None,
97
+ local_files_only=True # Force local file usage
98
  )
99
 
100
  # Load and dispatch model with accelerate
101
  pipe = load_checkpoint_and_dispatch(pipe, model_path, device_map="cpu", offload_folder=None)
102
+ pipe.load_ip_adapter("./", subfolder=None, weight_name="ipa-faceid-plus.bin")
103
 
104
  def generate_image(uploaded_image, prompt):
105
  img = cv2.cvtColor(np.array(uploaded_image), cv2.COLOR_RGB2BGR)
 
131
  description="Upload an image with a face, enter a prompt, and generate a new image preserving the reference face."
132
  )
133
 
134
+ interface.launch()