Commit
•
5b82e60
1
Parent(s):
182d36a
Update app.py
Browse files
app.py
CHANGED
@@ -49,7 +49,10 @@ def update_selection(evt: gr.SelectData):
|
|
49 |
)
|
50 |
|
51 |
@spaces.GPU(duration=80)
|
52 |
-
def generate_image(prompt, trigger_word, steps, cfg_scale, width, height, generator, lora_scale, progress):
|
|
|
|
|
|
|
53 |
with calculateDuration("Generating image"):
|
54 |
# Generate image
|
55 |
image = pipe(
|
@@ -82,9 +85,8 @@ def run_lora(prompt, cfg_scale, steps, selected_index, randomize_seed, seed, wid
|
|
82 |
with calculateDuration("Randomizing seed"):
|
83 |
if randomize_seed:
|
84 |
seed = random.randint(0, MAX_SEED)
|
85 |
-
generator = torch.Generator(device="cpu").manual_seed(seed)
|
86 |
|
87 |
-
image = generate_image(prompt, trigger_word, steps, cfg_scale, width, height, generator, lora_scale, progress)
|
88 |
|
89 |
pipe.unload_lora_weights()
|
90 |
return image, seed
|
|
|
49 |
)
|
50 |
|
51 |
@spaces.GPU(duration=80)
|
52 |
+
def generate_image(prompt, trigger_word, steps, seed, cfg_scale, width, height, generator, lora_scale, progress):
|
53 |
+
|
54 |
+
generator = torch.Generator(device="cuda").manual_seed(seed)
|
55 |
+
|
56 |
with calculateDuration("Generating image"):
|
57 |
# Generate image
|
58 |
image = pipe(
|
|
|
85 |
with calculateDuration("Randomizing seed"):
|
86 |
if randomize_seed:
|
87 |
seed = random.randint(0, MAX_SEED)
|
|
|
88 |
|
89 |
+
image = generate_image(prompt, trigger_word, steps, seed, cfg_scale, width, height, generator, lora_scale, progress)
|
90 |
|
91 |
pipe.unload_lora_weights()
|
92 |
return image, seed
|