Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -177,13 +177,11 @@ image_encoder = CLIPVisionModelWithProjection.from_pretrained(os.path.join(model
|
|
| 177 |
|
| 178 |
global pipeline
|
| 179 |
global MultiResNetModel
|
|
|
|
|
|
|
| 180 |
|
| 181 |
@spaces.GPU
|
| 182 |
def load_ckpt():
|
| 183 |
-
global pipeline
|
| 184 |
-
global MultiResNetModel
|
| 185 |
-
global causal_dit
|
| 186 |
-
global controlnet
|
| 187 |
weight_dtype = torch.float16
|
| 188 |
|
| 189 |
block_out_channels = [128, 128, 256, 512, 512]
|
|
@@ -297,11 +295,6 @@ global cur_style
|
|
| 297 |
cur_style = 'line + shadow'
|
| 298 |
@spaces.GPU
|
| 299 |
def change_ckpt(style):
|
| 300 |
-
global pipeline
|
| 301 |
-
global MultiResNetModel
|
| 302 |
-
global cur_style
|
| 303 |
-
# global causal_dit
|
| 304 |
-
# global controlnet
|
| 305 |
weight_dtype = torch.float16
|
| 306 |
|
| 307 |
if style == 'line':
|
|
@@ -388,7 +381,6 @@ def extract_line_image(query_image_, resolution):
|
|
| 388 |
|
| 389 |
@spaces.GPU
|
| 390 |
def extract_sketch_line_image(query_image_, input_style):
|
| 391 |
-
global cur_style
|
| 392 |
if input_style != cur_style:
|
| 393 |
change_ckpt(input_style)
|
| 394 |
|
|
@@ -427,8 +419,6 @@ def colorize_image(extracted_line, reference_images, resolution, seed, num_infer
|
|
| 427 |
if extracted_line is None:
|
| 428 |
gr.Info("Please preprocess the image first")
|
| 429 |
raise ValueError("Please preprocess the image first")
|
| 430 |
-
global pipeline
|
| 431 |
-
global MultiResNetModel
|
| 432 |
reference_images = process_multi_images(reference_images)
|
| 433 |
fix_random_seeds(seed)
|
| 434 |
|
|
|
|
| 177 |
|
| 178 |
global pipeline
|
| 179 |
global MultiResNetModel
|
| 180 |
+
global causal_dit
|
| 181 |
+
global controlnet
|
| 182 |
|
| 183 |
@spaces.GPU
|
| 184 |
def load_ckpt():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
weight_dtype = torch.float16
|
| 186 |
|
| 187 |
block_out_channels = [128, 128, 256, 512, 512]
|
|
|
|
| 295 |
cur_style = 'line + shadow'
|
| 296 |
@spaces.GPU
|
| 297 |
def change_ckpt(style):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
weight_dtype = torch.float16
|
| 299 |
|
| 300 |
if style == 'line':
|
|
|
|
| 381 |
|
| 382 |
@spaces.GPU
|
| 383 |
def extract_sketch_line_image(query_image_, input_style):
|
|
|
|
| 384 |
if input_style != cur_style:
|
| 385 |
change_ckpt(input_style)
|
| 386 |
|
|
|
|
| 419 |
if extracted_line is None:
|
| 420 |
gr.Info("Please preprocess the image first")
|
| 421 |
raise ValueError("Please preprocess the image first")
|
|
|
|
|
|
|
| 422 |
reference_images = process_multi_images(reference_images)
|
| 423 |
fix_random_seeds(seed)
|
| 424 |
|