Spaces:
Runtime error
Runtime error
Commit
Β·
926c7ec
1
Parent(s):
5f6b681
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,7 +48,7 @@ class Demo:
|
|
| 48 |
self.generating = False
|
| 49 |
self.device = 'cuda'
|
| 50 |
self.weight_dtype = torch.float16
|
| 51 |
-
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to(
|
| 52 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 53 |
with gr.Blocks() as demo:
|
| 54 |
self.layout()
|
|
@@ -233,6 +233,7 @@ class Demo:
|
|
| 233 |
# positive_prompt = ''
|
| 234 |
# if negative_prompt is None:
|
| 235 |
# negative_prompt = ''
|
|
|
|
| 236 |
if attributes_input == '':
|
| 237 |
attributes_input = None
|
| 238 |
print(target_concept, positive_prompt, negative_prompt, attributes_input, is_person)
|
|
@@ -267,7 +268,7 @@ class Demo:
|
|
| 267 |
generator = torch.manual_seed(seed)
|
| 268 |
|
| 269 |
model_path = model_map[model_name]
|
| 270 |
-
|
| 271 |
unet = self.pipe.unet
|
| 272 |
network_type = "c3lier"
|
| 273 |
if 'full' in model_path:
|
|
@@ -310,7 +311,7 @@ class Demo:
|
|
| 310 |
del unet, network
|
| 311 |
unet = None
|
| 312 |
network = None
|
| 313 |
-
pipe =
|
| 314 |
torch.cuda.empty_cache()
|
| 315 |
|
| 316 |
return edited_image, original_image
|
|
|
|
| 48 |
self.generating = False
|
| 49 |
self.device = 'cuda'
|
| 50 |
self.weight_dtype = torch.float16
|
| 51 |
+
self.pipe = StableDiffusionXLPipeline.from_pretrained('stabilityai/stable-diffusion-xl-base-1.0', torch_dtype=self.weight_dtype).to('cpu')
|
| 52 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 53 |
with gr.Blocks() as demo:
|
| 54 |
self.layout()
|
|
|
|
| 233 |
# positive_prompt = ''
|
| 234 |
# if negative_prompt is None:
|
| 235 |
# negative_prompt = ''
|
| 236 |
+
|
| 237 |
if attributes_input == '':
|
| 238 |
attributes_input = None
|
| 239 |
print(target_concept, positive_prompt, negative_prompt, attributes_input, is_person)
|
|
|
|
| 268 |
generator = torch.manual_seed(seed)
|
| 269 |
|
| 270 |
model_path = model_map[model_name]
|
| 271 |
+
self.pipe = self.pipe.to(self.device)
|
| 272 |
unet = self.pipe.unet
|
| 273 |
network_type = "c3lier"
|
| 274 |
if 'full' in model_path:
|
|
|
|
| 311 |
del unet, network
|
| 312 |
unet = None
|
| 313 |
network = None
|
| 314 |
+
self.pipe = self.pipe.to('cpu')
|
| 315 |
torch.cuda.empty_cache()
|
| 316 |
|
| 317 |
return edited_image, original_image
|