remove old comfyUI

This commit is contained in:
salt
2024-02-29 14:11:16 -08:00
parent d44ea6619d
commit 9aad2f3d72
2932 changed files with 0 additions and 932769 deletions
@@ -1,21 +0,0 @@
# [Rembg](https://github.com/danielgatis/rembg) Background Removal Node for [ComfyUI](https://github.com/comfyanonymous/ComfyUI)
1. Clone to your `custom_nodes` folder in ComfyUI:
```
git clone https://github.com/Jcd1230/rembg-comfyui-node.git
```
2. Install `rembg[gpu]` (recommended) or `rembg`, depending on GPU support, to your ComfyUI virtual environment. E.g.:
```
pip install rembg[gpu]
```
To use, just look for the *Image Remove Background (rembg)* node.
![Demonstration of the rembg node](https://i.imgur.com/12NEuyx.png)
## Acknowledgements
Thanks to [WASasquatch's Node Suite](https://github.com/WASasquatch/was-node-suite-comfyui) for great examples and a couple helper functions.
@@ -1,39 +0,0 @@
from rembg import remove
from PIL import Image
import torch
import numpy as np
# Tensor to PIL
def tensor2pil(image):
return Image.fromarray(np.clip(255. * image.cpu().numpy().squeeze(), 0, 255).astype(np.uint8))
# Convert PIL to Tensor
def pil2tensor(image):
return torch.from_numpy(np.array(image).astype(np.float32) / 255.0).unsqueeze(0)
class ImageRemoveBackgroundRembg:
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"image": ("IMAGE",),
},
}
RETURN_TYPES = ("IMAGE",)
FUNCTION = "remove_background"
CATEGORY = "image"
def remove_background(self, image):
image = pil2tensor(remove(tensor2pil(image)))
return (image,)
# A dictionary that contains all nodes you want to export with their names
# NOTE: names should be globally unique
NODE_CLASS_MAPPINGS = {
"Image Remove Background (rembg)": ImageRemoveBackgroundRembg
}