Spaces:
Runtime error
Runtime error
Update app_3.py
Browse files
app_3.py
CHANGED
|
@@ -150,14 +150,14 @@ vae = AutoencoderKL.from_pretrained(sd15_name, subfolder="vae")
|
|
| 150 |
unet = UNet2DConditionModel.from_pretrained(sd15_name, subfolder="unet")
|
| 151 |
# Load model directly
|
| 152 |
from transformers import AutoModelForImageSegmentation
|
| 153 |
-
|
| 154 |
-
|
| 155 |
|
| 156 |
# remove bg
|
| 157 |
-
rmbg = AutoModelForImageSegmentation.from_pretrained(
|
| 158 |
-
|
| 159 |
-
)
|
| 160 |
-
rmbg = rmbg.to(device)
|
| 161 |
|
| 162 |
model = DepthAnythingV2(encoder='vits', features=64, out_channels=[48, 96, 192, 384])
|
| 163 |
model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vits.pth', map_location=device))
|
|
@@ -783,19 +783,12 @@ def process_relight_bg(input_fg, input_bg, prompt, image_width, image_height, nu
|
|
| 783 |
|
| 784 |
quick_prompts = [
|
| 785 |
'sunshine from window',
|
| 786 |
-
'neon light, city',
|
| 787 |
-
'sunset over sea',
|
| 788 |
'golden time',
|
| 789 |
-
'sci-fi RGB glowing, cyberpunk',
|
| 790 |
'natural lighting',
|
| 791 |
'warm atmosphere, at home, bedroom',
|
| 792 |
-
'magic lit',
|
| 793 |
-
'evil, gothic, Yharnam',
|
| 794 |
-
'light and shadow',
|
| 795 |
'shadow from window',
|
| 796 |
'soft studio lighting',
|
| 797 |
'home atmosphere, cozy bedroom illumination',
|
| 798 |
-
'neon, Wong Kar-wai, warm'
|
| 799 |
]
|
| 800 |
quick_prompts = [[x] for x in quick_prompts]
|
| 801 |
|
|
|
|
| 150 |
unet = UNet2DConditionModel.from_pretrained(sd15_name, subfolder="unet")
|
| 151 |
# Load model directly
|
| 152 |
from transformers import AutoModelForImageSegmentation
|
| 153 |
+
rmbg = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-1.4", trust_remote_code=True)
|
| 154 |
+
rmbg = rmbg.to(device=device, dtype=torch.float32) # Keep this as float32
|
| 155 |
|
| 156 |
# remove bg
|
| 157 |
+
# rmbg = AutoModelForImageSegmentation.from_pretrained(
|
| 158 |
+
# "ZhengPeng7/BiRefNet", trust_remote_code=True
|
| 159 |
+
# )
|
| 160 |
+
# rmbg = rmbg.to(device)
|
| 161 |
|
| 162 |
model = DepthAnythingV2(encoder='vits', features=64, out_channels=[48, 96, 192, 384])
|
| 163 |
model.load_state_dict(torch.load('checkpoints/depth_anything_v2_vits.pth', map_location=device))
|
|
|
|
| 783 |
|
| 784 |
quick_prompts = [
|
| 785 |
'sunshine from window',
|
|
|
|
|
|
|
| 786 |
'golden time',
|
|
|
|
| 787 |
'natural lighting',
|
| 788 |
'warm atmosphere, at home, bedroom',
|
|
|
|
|
|
|
|
|
|
| 789 |
'shadow from window',
|
| 790 |
'soft studio lighting',
|
| 791 |
'home atmosphere, cozy bedroom illumination',
|
|
|
|
| 792 |
]
|
| 793 |
quick_prompts = [[x] for x in quick_prompts]
|
| 794 |
|