Spaces:
Runtime error
Runtime error
Commit ·
90a5bb8
1
Parent(s): 76e65ba
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,15 +22,13 @@ model_id = "CompVis/stable-diffusion-v1-4"
|
|
| 22 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
context = autocast if device == "cuda" else nullcontext
|
| 24 |
|
| 25 |
-
pipe = StableDiffusionPipeline.from_pretrained(model_id,
|
| 26 |
|
| 27 |
|
| 28 |
def infer(prompt,samples):
|
| 29 |
-
all_images = []
|
| 30 |
with context(device):
|
| 31 |
-
images = pipe(samples*[prompt],num_inference_steps=50, guidance_scale=7.5, height=400, width=400).
|
| 32 |
-
|
| 33 |
-
return all_images
|
| 34 |
|
| 35 |
|
| 36 |
demo = gr.Blocks()
|
|
|
|
| 22 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
context = autocast if device == "cuda" else nullcontext
|
| 24 |
|
| 25 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id,use_auth_token=token).to(device)
|
| 26 |
|
| 27 |
|
| 28 |
def infer(prompt,samples):
|
|
|
|
| 29 |
with context(device):
|
| 30 |
+
images = pipe(samples*[prompt],num_inference_steps=50, guidance_scale=7.5, height=400, width=400).images
|
| 31 |
+
return images
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
demo = gr.Blocks()
|