jonigata commited on
Commit
f9a1074
1 Parent(s): 9e932a5
Files changed (2) hide show
  1. app.py +0 -3
  2. sd_model.py +3 -0
app.py CHANGED
@@ -11,8 +11,6 @@ import os
11
  import numpy as np
12
  from PIL import Image
13
 
14
- import spaces
15
-
16
  path = os.getcwd()
17
  output_dir = f"{path}/output"
18
  input_dir = f"{path}/input"
@@ -25,7 +23,6 @@ class webui:
25
  def __init__(self):
26
  self.demo = gr.Blocks()
27
 
28
- @spaces.GPU
29
  def undercoat(self, input_image, pos_prompt, neg_prompt, alpha_th):
30
  org_line_image = input_image
31
  image = pil2cv(input_image)
 
11
  import numpy as np
12
  from PIL import Image
13
 
 
 
14
  path = os.getcwd()
15
  output_dir = f"{path}/output"
16
  input_dir = f"{path}/input"
 
23
  def __init__(self):
24
  self.demo = gr.Blocks()
25
 
 
26
  def undercoat(self, input_image, pos_prompt, neg_prompt, alpha_th):
27
  org_line_image = input_image
28
  image = pil2cv(input_image)
sd_model.py CHANGED
@@ -2,6 +2,8 @@ from diffusers import StableDiffusionControlNetPipeline, ControlNetModel, UniPCM
2
  from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel, AutoencoderKL
3
  import torch
4
 
 
 
5
  device = "cuda"
6
 
7
  def get_cn_pipeline():
@@ -48,6 +50,7 @@ def get_cn_detector(image):
48
  print(detectors)
49
  return detectors
50
 
 
51
  def generate(pipe, detectors, prompt, negative_prompt):
52
  default_pos = "1girl, bestquality, 4K, ((white background)), no background"
53
  default_neg = "shadow, (worst quality, low quality:1.2), (lowres:1.2), (bad anatomy:1.2), (greyscale, monochrome:1.4)"
 
2
  from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel, AutoencoderKL
3
  import torch
4
 
5
+ import spaces
6
+
7
  device = "cuda"
8
 
9
  def get_cn_pipeline():
 
50
  print(detectors)
51
  return detectors
52
 
53
+ @spaces.GPU
54
  def generate(pipe, detectors, prompt, negative_prompt):
55
  default_pos = "1girl, bestquality, 4K, ((white background)), no background"
56
  default_neg = "shadow, (worst quality, low quality:1.2), (lowres:1.2), (bad anatomy:1.2), (greyscale, monochrome:1.4)"