Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -164,22 +164,13 @@ class StableNormal(Geowizard):
|
|
164 |
|
165 |
class YosoNormal(Geowizard):
|
166 |
def __init__(self):
|
167 |
-
self.model =
|
168 |
-
|
169 |
-
|
170 |
-
# two stage concat
|
171 |
-
self.model.x_start_pipeline = x_start_pipeline
|
172 |
-
self.model.x_start_pipeline.to('cuda', torch.float16)
|
173 |
-
self.model.prior.to('cuda', torch.float16)
|
174 |
-
|
175 |
|
176 |
@torch.no_grad()
|
177 |
def __call__(self, img, image_resolution=768):
|
178 |
-
|
179 |
-
pred_normal =
|
180 |
-
pred_normal = (pred_normal + 1) / 2 * 255
|
181 |
-
pred_normal = pred_normal.astype(np.uint8)
|
182 |
-
|
183 |
return pred_normal
|
184 |
|
185 |
def to(self, device):
|
|
|
164 |
|
165 |
class YosoNormal(Geowizard):
|
166 |
def __init__(self):
|
167 |
+
self.model = torch.hub.load("hugoycj/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-8-1')
|
168 |
+
self.model.to('cuda', torch.float16)
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
@torch.no_grad()
|
171 |
def __call__(self, img, image_resolution=768):
|
172 |
+
pred_normal = self.model(Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)))
|
173 |
+
pred_normal = np.asarray(pred_normal)
|
|
|
|
|
|
|
174 |
return pred_normal
|
175 |
|
176 |
def to(self, device):
|