naonauno commited on
Commit
d4a560e
·
verified ·
1 Parent(s): f552811

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import torch
3
- from diffusers import StableDiffusionPipeline, ControlNetModel
4
- from safetensors.torch import load_file
5
 
6
  # Initialize the pipeline with CPU
7
  model_id = "runwayml/stable-diffusion-v1-5"
@@ -10,9 +10,15 @@ pipe = StableDiffusionPipeline.from_pretrained(
10
  torch_dtype=torch.float32,
11
  )
12
 
13
- # Load your ControlNet LoRA
14
  lora_path = "naonauno/40k-half-sd15"
15
- pipe.load_lora_weights(lora_path)
 
 
 
 
 
 
16
 
17
  def generate_image(prompt, negative_prompt, guidance_scale, steps):
18
  with torch.no_grad():
 
1
  import gradio as gr
2
  import torch
3
+ from diffusers import StableDiffusionPipeline
4
+ from huggingface_hub import hf_hub_download
5
 
6
  # Initialize the pipeline with CPU
7
  model_id = "runwayml/stable-diffusion-v1-5"
 
10
  torch_dtype=torch.float32,
11
  )
12
 
13
+ # Load your LoRA weights
14
  lora_path = "naonauno/40k-half-sd15"
15
+ pipe.load_lora_weights(
16
+ lora_path,
17
+ weight_name="40kHalf.safetensors"
18
+ )
19
+
20
+ # Set the cross attention processor scale
21
+ pipe.fuse_lora(scale=1.0)
22
 
23
  def generate_image(prompt, negative_prompt, guidance_scale, steps):
24
  with torch.no_grad():