Spaces:
Running
Running
hysts
commited on
Commit
•
0fb46e4
1
Parent(s):
80d903f
debug
Browse files
app.py
CHANGED
@@ -144,6 +144,7 @@ Note: Currently, only 5 types of textures are supported, i.e., pure color, strip
|
|
144 |
enable_queue=args.enable_queue,
|
145 |
server_port=args.port,
|
146 |
share=args.share,
|
|
|
147 |
)
|
148 |
|
149 |
|
144 |
enable_queue=args.enable_queue,
|
145 |
server_port=args.port,
|
146 |
share=args.share,
|
147 |
+
debug=True,
|
148 |
)
|
149 |
|
150 |
|
model.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from __future__ import annotations
|
2 |
|
|
|
3 |
import os
|
4 |
import pathlib
|
5 |
import sys
|
@@ -18,6 +19,17 @@ from utils.language_utils import (generate_shape_attributes,
|
|
18 |
from utils.options import dict_to_nonedict, parse
|
19 |
from utils.util import set_random_seed
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
COLOR_LIST = [
|
22 |
(0, 0, 0),
|
23 |
(255, 250, 250),
|
@@ -73,6 +85,7 @@ class Model:
|
|
73 |
|
74 |
@staticmethod
|
75 |
def preprocess_pose_image(image: PIL.Image.Image) -> torch.Tensor:
|
|
|
76 |
image = np.array(
|
77 |
image.resize(
|
78 |
size=(256, 512),
|
@@ -109,6 +122,7 @@ class Model:
|
|
109 |
shape_text: str) -> np.ndarray:
|
110 |
if pose_data is None:
|
111 |
return
|
|
|
112 |
self.model.feed_pose_data(pose_data)
|
113 |
shape_attributes = generate_shape_attributes(shape_text)
|
114 |
shape_attributes = torch.LongTensor(shape_attributes).unsqueeze(0)
|
@@ -122,6 +136,8 @@ class Model:
|
|
122 |
sample_steps: int, seed: int) -> np.ndarray:
|
123 |
if label_image is None:
|
124 |
return
|
|
|
|
|
125 |
mask = label_image.copy()
|
126 |
seg_map = self.process_mask(mask)
|
127 |
self.model.segm = torch.from_numpy(seg_map).unsqueeze(0).unsqueeze(
|
1 |
from __future__ import annotations
|
2 |
|
3 |
+
import logging
|
4 |
import os
|
5 |
import pathlib
|
6 |
import sys
|
19 |
from utils.options import dict_to_nonedict, parse
|
20 |
from utils.util import set_random_seed
|
21 |
|
22 |
+
logger = logging.getLogger(__name__)
|
23 |
+
logger.setLevel(logging.DEBUG)
|
24 |
+
logger.propagate = False
|
25 |
+
formatter = logging.Formatter(
|
26 |
+
'[%(asctime)s] %(name)s %(levelname)s: %(message)s',
|
27 |
+
datefmt='%Y-%m-%d %H:%M:%S')
|
28 |
+
handler = logging.StreamHandler(stream=sys.stdout)
|
29 |
+
handler.setLevel(logging.DEBUG)
|
30 |
+
handler.setFormatter(formatter)
|
31 |
+
logger.addHandler(handler)
|
32 |
+
|
33 |
COLOR_LIST = [
|
34 |
(0, 0, 0),
|
35 |
(255, 250, 250),
|
85 |
|
86 |
@staticmethod
|
87 |
def preprocess_pose_image(image: PIL.Image.Image) -> torch.Tensor:
|
88 |
+
logger.debug(f'{image.size=}')
|
89 |
image = np.array(
|
90 |
image.resize(
|
91 |
size=(256, 512),
|
122 |
shape_text: str) -> np.ndarray:
|
123 |
if pose_data is None:
|
124 |
return
|
125 |
+
logger.debug(f'{len(shape_text)=}')
|
126 |
self.model.feed_pose_data(pose_data)
|
127 |
shape_attributes = generate_shape_attributes(shape_text)
|
128 |
shape_attributes = torch.LongTensor(shape_attributes).unsqueeze(0)
|
136 |
sample_steps: int, seed: int) -> np.ndarray:
|
137 |
if label_image is None:
|
138 |
return
|
139 |
+
logger.debug(f'{len(texture_text)=}')
|
140 |
+
logger.debug(f'{sample_steps=}')
|
141 |
mask = label_image.copy()
|
142 |
seg_map = self.process_mask(mask)
|
143 |
self.model.segm = torch.from_numpy(seg_map).unsqueeze(0).unsqueeze(
|