Update app.py
Browse files
app.py
CHANGED
|
@@ -67,19 +67,24 @@ def generate(prompt, negative_prompt, guidance, strength, seed, width, height):
|
|
| 67 |
|
| 68 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
|
| 85 |
with gr.Blocks() as interface:
|
|
|
|
| 67 |
|
| 68 |
generator = torch.Generator(device="cuda").manual_seed(seed)
|
| 69 |
|
| 70 |
+
try:
|
| 71 |
+
result = pipe(
|
| 72 |
+
prompt=prompt,
|
| 73 |
+
negative_prompt=negative_prompt,
|
| 74 |
+
width=width,
|
| 75 |
+
height=height,
|
| 76 |
+
num_inference_steps=NUM_INFERENCE_STEPS,
|
| 77 |
+
guidance_scale=guidance,
|
| 78 |
+
generator=generator,
|
| 79 |
+
callback_on_step_end=callback,
|
| 80 |
+
callback_on_step_end_tensor_inputs=["latents"],
|
| 81 |
+
)
|
| 82 |
+
image = result.images[0]
|
| 83 |
+
del result
|
| 84 |
+
return image
|
| 85 |
+
finally:
|
| 86 |
+
pipe.disable_lora()
|
| 87 |
+
torch.cuda.empty_cache()
|
| 88 |
|
| 89 |
|
| 90 |
with gr.Blocks() as interface:
|