Stable-X commited on
Commit
fa9493b
·
verified ·
1 Parent(s): a5a71d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -164,22 +164,13 @@ class StableNormal(Geowizard):
164
 
165
  class YosoNormal(Geowizard):
166
  def __init__(self):
167
- self.model = YOSONormalsPipeline.from_pretrained('Stable-X/yoso-normal-v0-3', trust_remote_code=True,
168
- variant="fp16", torch_dtype=torch.float16, t_start=0)
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
- pipe_out = self.model(Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)))
179
- pred_normal = pipe_out.prediction[0]
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):