Spaces:
Runtime error
Runtime error
Commit
•
b0d47c2
1
Parent(s):
c5bfed7
Update to the final API naming (#1)
Browse files- Update to the final API naming (fea7223c45f766a2b821167db5b88b9c640163d1)
Co-authored-by: Multimodal AI art <multimodalart@users.noreply.huggingface.co>
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
from diffusers import
|
2 |
import gradio as gr
|
3 |
import PIL.Image
|
4 |
import numpy as np
|
5 |
import random
|
6 |
import torch
|
7 |
|
8 |
-
ldm_pipeline =
|
9 |
|
10 |
def predict(prompt, steps=100, seed=42, guidance_scale=6.0):
|
11 |
torch.cuda.empty_cache()
|
12 |
generator = torch.manual_seed(seed)
|
13 |
-
images = ldm_pipeline([prompt], generator=generator, num_inference_steps=steps, eta=0.3, guidance_scale=guidance_scale)
|
14 |
return images[0]
|
15 |
|
16 |
random_seed = random.randint(0, 2147483647)
|
|
|
1 |
+
from diffusers import LDMTextToImagePipeline
|
2 |
import gradio as gr
|
3 |
import PIL.Image
|
4 |
import numpy as np
|
5 |
import random
|
6 |
import torch
|
7 |
|
8 |
+
ldm_pipeline = LDMTextToImagePipeline.from_pretrained("CompVis/ldm-text2im-large-256")
|
9 |
|
10 |
def predict(prompt, steps=100, seed=42, guidance_scale=6.0):
|
11 |
torch.cuda.empty_cache()
|
12 |
generator = torch.manual_seed(seed)
|
13 |
+
images = ldm_pipeline([prompt], generator=generator, num_inference_steps=steps, eta=0.3, guidance_scale=guidance_scale)["sample"]
|
14 |
return images[0]
|
15 |
|
16 |
random_seed = random.randint(0, 2147483647)
|