Spaces:
Runtime error
Runtime error
abubakar123456
commited on
Commit
•
2421b42
1
Parent(s):
8193585
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
import argparse
|
2 |
import os
|
3 |
-
os.environ['CUDA_HOME'] = '/usr/local/cuda'
|
4 |
-
os.environ['PATH'] = os.environ['PATH'] + ':/usr/local/cuda/bin'
|
5 |
from datetime import datetime
|
6 |
|
7 |
-
|
8 |
-
import spaces
|
9 |
-
|
10 |
import gradio as gr
|
11 |
import numpy as np
|
12 |
import torch
|
|
|
13 |
|
14 |
from diffusers.image_processor import VaeImageProcessor
|
15 |
from huggingface_hub import snapshot_download
|
@@ -115,19 +111,18 @@ pipeline = CatVTONPipeline(
|
|
115 |
attn_ckpt_version="mix",
|
116 |
weight_dtype=init_weight_dtype(args.mixed_precision),
|
117 |
use_tf32=args.allow_tf32,
|
118 |
-
device='cuda'
|
119 |
-
|
120 |
)
|
121 |
# AutoMasker
|
122 |
mask_processor = VaeImageProcessor(vae_scale_factor=8, do_normalize=False, do_binarize=True, do_convert_grayscale=True)
|
123 |
automasker = AutoMasker(
|
124 |
densepose_ckpt=os.path.join(repo_path, "DensePose"),
|
125 |
schp_ckpt=os.path.join(repo_path, "SCHP"),
|
126 |
-
device='cuda',
|
127 |
-
|
128 |
)
|
129 |
|
130 |
-
@spaces.GPU(duration=120)
|
131 |
def submit_function(
|
132 |
person_image,
|
133 |
cloth_image,
|
@@ -154,8 +149,8 @@ def submit_function(
|
|
154 |
|
155 |
generator = None
|
156 |
if seed != -1:
|
157 |
-
generator = torch.Generator(device='cuda').manual_seed(seed)
|
158 |
-
|
159 |
|
160 |
person_image = Image.open(person_image).convert("RGB")
|
161 |
cloth_image = Image.open(cloth_image).convert("RGB")
|
|
|
1 |
import argparse
|
2 |
import os
|
|
|
|
|
3 |
from datetime import datetime
|
4 |
|
|
|
|
|
|
|
5 |
import gradio as gr
|
6 |
import numpy as np
|
7 |
import torch
|
8 |
+
device = torch.device('cpu') # Explicitly use CPU if desired
|
9 |
|
10 |
from diffusers.image_processor import VaeImageProcessor
|
11 |
from huggingface_hub import snapshot_download
|
|
|
111 |
attn_ckpt_version="mix",
|
112 |
weight_dtype=init_weight_dtype(args.mixed_precision),
|
113 |
use_tf32=args.allow_tf32,
|
114 |
+
# device='cuda'
|
115 |
+
device='cpu'
|
116 |
)
|
117 |
# AutoMasker
|
118 |
mask_processor = VaeImageProcessor(vae_scale_factor=8, do_normalize=False, do_binarize=True, do_convert_grayscale=True)
|
119 |
automasker = AutoMasker(
|
120 |
densepose_ckpt=os.path.join(repo_path, "DensePose"),
|
121 |
schp_ckpt=os.path.join(repo_path, "SCHP"),
|
122 |
+
# device='cuda',
|
123 |
+
device='cpu'
|
124 |
)
|
125 |
|
|
|
126 |
def submit_function(
|
127 |
person_image,
|
128 |
cloth_image,
|
|
|
149 |
|
150 |
generator = None
|
151 |
if seed != -1:
|
152 |
+
# generator = torch.Generator(device='cuda').manual_seed(seed)
|
153 |
+
generator = torch.Generator(device='cpu').manual_seed(seed)
|
154 |
|
155 |
person_image = Image.open(person_image).convert("RGB")
|
156 |
cloth_image = Image.open(cloth_image).convert("RGB")
|