Spaces:
Build error
Build error
Update trellis/pipelines/trellis_image_to_3d.py
Browse files230 unmodified lines231232233234235236237238239240241242243244544 unmodified lines789790791792793794795796797798799230 unmodified linesif scale < 1:input = input.resize((int(input.width * scale), int(input.height * scale)), Image.Resampling.LANCZOS)# Get mask using BiRefNetmask = self._get_birefnet_mask(input)# Convert input to RGBA and apply maskinput_rgba = input.convert('RGBA')input_array = np.array(input_rgba)input_array[:, :, 3] = mask * 255 # Apply mask to alpha channeloutput = Image.fromarray(input_array)# Process the output imageoutput_np = np.array(output)544 unmodified linesdel new_pipeline.VGGT_model.point_headnew_pipeline.VGGT_model.eval()new_pipeline.birefnet_model = AutoModelForImageSegmentation.from_pretrained('ZhengPeng7/BiRefNet',trust_remote_code=True).cpu()new_pipeline.birefnet_model.eval()new_pipeline.sparse_structure_sampler = getattr(samplers, args['sparse_structure_sampler']['name'])(**args['sparse_structure_sampler']['args'])new_pipeline.sparse_structure_sampler_params = args['sparse_structure_sampler']['params']230 unmodified lines231232233234235236237238239240241242243244245246247544 unmodified lines792793794795796797798799800801802230 unmodified linesif scale < 1:input = input.resize((int(input.width * scale), int(input.height * scale)), Image.Resampling.LANCZOS)# # Get mask using BiRefNet# mask = self._get_birefnet_mask(input)# # Convert input to RGBA and apply mask# input_rgba = input.convert('RGBA')# input_array = np.array(input_rgba)# input_array[:, :, 3] = mask * 255 # Apply mask to alpha channel# output = Image.fromarray(input_array)if getattr(self, 'rembg_session', None) is None:self.rembg_session = rembg.new_session('u2net')output = rembg.remove(input, session=self.rembg_session)# Process the output imageoutput_np = np.array(output)544 unmodified linesdel new_pipeline.VGGT_model.point_headnew_pipeline.VGGT_model.eval()# new_pipeline.birefnet_model = AutoModelForImageSegmentation.from_pretrained(# 'ZhengPeng7/BiRefNet',# trust_remote_code=True# ).cpu()# new_pipeline.birefnet_model.eval()new_pipeline.sparse_structure_sampler = getattr(samplers, args['sparse_structure_sampler']['name'])(**args['sparse_structure_sampler']['args'])new_pipeline.sparse_structure_sampler_params = args['sparse_structure_sampler']['params']
trellis/pipelines/trellis_image_to_3d.py+15-12