mattyamonaca commited on
Commit
bbbffe1
1 Parent(s): 7eecfbf
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -5,13 +5,13 @@ from starline import process
5
  from utils import load_cn_model, load_cn_config, randomname
6
  from convertor import pil2cv, cv2pil
7
 
8
- from sd_model import get_cn_pipeline, generate, get_cn_detector
9
  import cv2
10
  import os
11
  import numpy as np
12
  from PIL import Image
13
  import zipfile
14
- import spaces
15
 
16
  path = os.getcwd()
17
  output_dir = f"{path}/output"
@@ -22,7 +22,8 @@ load_cn_model(cn_lineart_dir)
22
  load_cn_config(cn_lineart_dir)
23
  pipe = get_cn_pipeline()
24
 
25
- @spaces.GPU(duration=120)
 
26
  def generate(detectors, prompt, negative_prompt, reference_flg=False, reference_img=None):
27
  default_pos = ""
28
  default_neg = ""
@@ -107,7 +108,7 @@ class webui:
107
 
108
  detectors = get_cn_detector(input_image.resize((1024, 1024), Image.ANTIALIAS))
109
 
110
- gen_image = generate(pipe, detectors, pos_prompt, neg_prompt, reference_flg, reference_img)
111
  color_img, unfinished = process(gen_image.resize((image.shape[1], image.shape[0]), Image.ANTIALIAS) , org_line_image, alpha_th, thickness)
112
  #color_img = color_img.resize((image.shape[1], image.shape[0]) , Image.ANTIALIAS)
113
 
 
5
  from utils import load_cn_model, load_cn_config, randomname
6
  from convertor import pil2cv, cv2pil
7
 
8
+ from sd_model import get_cn_pipeline, get_cn_detector
9
  import cv2
10
  import os
11
  import numpy as np
12
  from PIL import Image
13
  import zipfile
14
+ #import spaces
15
 
16
  path = os.getcwd()
17
  output_dir = f"{path}/output"
 
22
  load_cn_config(cn_lineart_dir)
23
  pipe = get_cn_pipeline()
24
 
25
+
26
+ #@spaces.GPU(duration=120)
27
  def generate(detectors, prompt, negative_prompt, reference_flg=False, reference_img=None):
28
  default_pos = ""
29
  default_neg = ""
 
108
 
109
  detectors = get_cn_detector(input_image.resize((1024, 1024), Image.ANTIALIAS))
110
 
111
+ gen_image = generate(detectors, pos_prompt, neg_prompt, reference_flg, reference_img)
112
  color_img, unfinished = process(gen_image.resize((image.shape[1], image.shape[0]), Image.ANTIALIAS) , org_line_image, alpha_th, thickness)
113
  #color_img = color_img.resize((image.shape[1], image.shape[0]) , Image.ANTIALIAS)
114