JunhaoZhuang commited on
Commit
441848c
·
verified ·
1 Parent(s): b4c4b2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -25
app.py CHANGED
@@ -183,11 +183,6 @@ cur_style = 'line + shadow'
183
 
184
  @spaces.GPU
185
  def load_ckpt():
186
- global pipeline
187
- global MultiResNetModel
188
- global causal_dit
189
- global controlnet
190
- global cur_style
191
  weight_dtype = torch.float16
192
 
193
  block_out_channels = [128, 128, 256, 512, 512]
@@ -301,11 +296,6 @@ load_ckpt()
301
 
302
  @spaces.GPU
303
  def change_ckpt(style):
304
- global pipeline
305
- global MultiResNetModel
306
- global causal_dit
307
- global controlnet
308
- global cur_style
309
  weight_dtype = torch.float16
310
 
311
  if style == 'line':
@@ -357,11 +347,6 @@ def process_multi_images(files):
357
 
358
  @spaces.GPU
359
  def extract_lines(image):
360
- global pipeline
361
- global MultiResNetModel
362
- global causal_dit
363
- global controlnet
364
- global cur_style
365
  src = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2GRAY)
366
 
367
  rows = int(np.ceil(src.shape[0] / 16)) * 16
@@ -387,11 +372,6 @@ def extract_lines(image):
387
 
388
  @spaces.GPU
389
  def extract_line_image(query_image_, resolution):
390
- global pipeline
391
- global MultiResNetModel
392
- global causal_dit
393
- global controlnet
394
- global cur_style
395
  tar_width, tar_height = resolution
396
  query_image = query_image_.resize((tar_width, tar_height))
397
  query_image = query_image.convert('L').convert('RGB')
@@ -437,11 +417,6 @@ def extract_sketch_line_image(query_image_, input_style):
437
 
438
  @spaces.GPU(duration=120)
439
  def colorize_image(extracted_line, reference_images, resolution, seed, num_inference_steps, top_k, hint_mask=None, hint_color=None, query_image_origin=None, extracted_image_ori=None):
440
- global pipeline
441
- global MultiResNetModel
442
- global causal_dit
443
- global controlnet
444
- global cur_style
445
  if extracted_line is None:
446
  gr.Info("Please preprocess the image first")
447
  raise ValueError("Please preprocess the image first")
 
183
 
184
  @spaces.GPU
185
  def load_ckpt():
 
 
 
 
 
186
  weight_dtype = torch.float16
187
 
188
  block_out_channels = [128, 128, 256, 512, 512]
 
296
 
297
  @spaces.GPU
298
  def change_ckpt(style):
 
 
 
 
 
299
  weight_dtype = torch.float16
300
 
301
  if style == 'line':
 
347
 
348
  @spaces.GPU
349
  def extract_lines(image):
 
 
 
 
 
350
  src = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2GRAY)
351
 
352
  rows = int(np.ceil(src.shape[0] / 16)) * 16
 
372
 
373
  @spaces.GPU
374
  def extract_line_image(query_image_, resolution):
 
 
 
 
 
375
  tar_width, tar_height = resolution
376
  query_image = query_image_.resize((tar_width, tar_height))
377
  query_image = query_image.convert('L').convert('RGB')
 
417
 
418
  @spaces.GPU(duration=120)
419
  def colorize_image(extracted_line, reference_images, resolution, seed, num_inference_steps, top_k, hint_mask=None, hint_color=None, query_image_origin=None, extracted_image_ori=None):
 
 
 
 
 
420
  if extracted_line is None:
421
  gr.Info("Please preprocess the image first")
422
  raise ValueError("Please preprocess the image first")