Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import numpy as np
|
|
| 6 |
from io import BytesIO
|
| 7 |
from diffusers import StableDiffusionImg2ImgPipeline
|
| 8 |
|
| 9 |
-
device="
|
| 10 |
|
| 11 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=st.secrets['USER_TOKEN'])
|
| 12 |
pipe.to(device)
|
|
@@ -17,7 +17,7 @@ def resize(value,img):
|
|
| 17 |
return img
|
| 18 |
|
| 19 |
def infer(source_img, prompt, guide, steps, seed, Strength):
|
| 20 |
-
generator = torch.Generator('
|
| 21 |
source_image = resize(512, source_img)
|
| 22 |
source_image.save('source.png')
|
| 23 |
image_list = pipe([prompt], init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps)
|
|
|
|
| 6 |
from io import BytesIO
|
| 7 |
from diffusers import StableDiffusionImg2ImgPipeline
|
| 8 |
|
| 9 |
+
device="cpu"
|
| 10 |
|
| 11 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=st.secrets['USER_TOKEN'])
|
| 12 |
pipe.to(device)
|
|
|
|
| 17 |
return img
|
| 18 |
|
| 19 |
def infer(source_img, prompt, guide, steps, seed, Strength):
|
| 20 |
+
generator = torch.Generator('cpu').manual_seed(seed)
|
| 21 |
source_image = resize(512, source_img)
|
| 22 |
source_image.save('source.png')
|
| 23 |
image_list = pipe([prompt], init_image=source_image, strength=Strength, guidance_scale=guide, num_inference_steps=steps)
|