fffiloni commited on
Commit
2419492
1 Parent(s): c058625

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -1,11 +1,17 @@
1
  import gradio
 
 
 
 
 
 
2
  from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
3
  from diffusers.utils import load_image
4
  from PIL import Image
5
  import torch
6
  import numpy as np
7
  import cv2
8
- import os
9
 
10
  controlnet = ControlNetModel.from_pretrained(
11
  "diffusers/controlnet-canny-sdxl-1.0",
@@ -18,6 +24,12 @@ pipe = StableDiffusionXLControlNetPipeline.from_pretrained(
18
  vae=vae,
19
  torch_dtype=torch.float16,
20
  )
 
 
 
 
 
 
21
  pipe.enable_model_cpu_offload()
22
 
23
  def infer(image_in):
@@ -28,8 +40,6 @@ def infer(image_in):
28
 
29
  controlnet_conditioning_scale = 0.5 # recommended for good generalization
30
 
31
-
32
-
33
  image = np.array(image)
34
  image = cv2.Canny(image, 100, 200)
35
  image = image[:, :, None]
 
1
  import gradio
2
+ from huggingface_hub import login
3
+ import os
4
+
5
+ hf_token = os.environ.get("HF_TOKEN")
6
+ login(token=hf_token)
7
+
8
  from diffusers import ControlNetModel, StableDiffusionXLControlNetPipeline, AutoencoderKL
9
  from diffusers.utils import load_image
10
  from PIL import Image
11
  import torch
12
  import numpy as np
13
  import cv2
14
+
15
 
16
  controlnet = ControlNetModel.from_pretrained(
17
  "diffusers/controlnet-canny-sdxl-1.0",
 
24
  vae=vae,
25
  torch_dtype=torch.float16,
26
  )
27
+
28
+ custom_model = "fffiloni/eugene_jour_general"
29
+
30
+ # This is where you load your trained weights
31
+ pipe.load_lora_weights(custom_model, use_auth_token=True)
32
+ #pipe.to("cuda")
33
  pipe.enable_model_cpu_offload()
34
 
35
  def infer(image_in):
 
40
 
41
  controlnet_conditioning_scale = 0.5 # recommended for good generalization
42
 
 
 
43
  image = np.array(image)
44
  image = cv2.Canny(image, 100, 200)
45
  image = image[:, :, None]