Commit
·
ad8076c
1
Parent(s):
a5454cf
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,10 +55,10 @@ css = '''
|
|
| 55 |
}
|
| 56 |
'''
|
| 57 |
|
| 58 |
-
|
| 59 |
-
original_pipe = copy.deepcopy(pipe)
|
| 60 |
|
| 61 |
def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lora_2_scale=0.5, progress=gr.Progress(track_tqdm=True)):
|
|
|
|
| 62 |
pipe = copy.deepcopy(original_pipe)
|
| 63 |
pipe.to("cuda")
|
| 64 |
pipe.load_lora_weights(shuffled_items[0]['state_dict'])
|
|
@@ -70,10 +70,10 @@ def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lor
|
|
| 70 |
negative_prompt = None
|
| 71 |
|
| 72 |
image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=20, width=768, height=768).images[0]
|
|
|
|
| 73 |
del pipe
|
| 74 |
gc.collect()
|
| 75 |
torch.cuda.empty_cache()
|
| 76 |
-
return image
|
| 77 |
|
| 78 |
def get_description(item):
|
| 79 |
trigger_word = item["trigger_word"]
|
|
|
|
| 55 |
}
|
| 56 |
'''
|
| 57 |
|
| 58 |
+
original_pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
|
|
|
|
| 59 |
|
| 60 |
def merge_and_run(prompt, negative_prompt, shuffled_items, lora_1_scale=0.5, lora_2_scale=0.5, progress=gr.Progress(track_tqdm=True)):
|
| 61 |
+
print(shuffled_items)
|
| 62 |
pipe = copy.deepcopy(original_pipe)
|
| 63 |
pipe.to("cuda")
|
| 64 |
pipe.load_lora_weights(shuffled_items[0]['state_dict'])
|
|
|
|
| 70 |
negative_prompt = None
|
| 71 |
|
| 72 |
image = pipe(prompt=prompt, negative_prompt=negative_prompt, num_inference_steps=20, width=768, height=768).images[0]
|
| 73 |
+
yield image
|
| 74 |
del pipe
|
| 75 |
gc.collect()
|
| 76 |
torch.cuda.empty_cache()
|
|
|
|
| 77 |
|
| 78 |
def get_description(item):
|
| 79 |
trigger_word = item["trigger_word"]
|