Spaces:
Runtime error
Runtime error
more tweaks to get cpu to work
Browse files
app.py
CHANGED
@@ -37,13 +37,14 @@ def download_image(url):
|
|
37 |
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
38 |
|
39 |
model_path = "runwayml/stable-diffusion-inpainting"
|
|
|
40 |
|
41 |
pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
42 |
model_path,
|
43 |
-
revision="fp16",
|
44 |
-
torch_dtype=torch.float16,
|
45 |
use_auth_token=True
|
46 |
-
)
|
47 |
|
48 |
img_url = "https://cdn.faire.com/fastly/893b071985d70819da5f0d485f1b1bb97ee4f16a6e14ef1bdd4a086b3588be58.png" # wino
|
49 |
image = download_image(img_url).resize((512, 512))
|
@@ -53,7 +54,7 @@ prompt = "crazy portal universe"
|
|
53 |
|
54 |
guidance_scale=7.5
|
55 |
num_samples = 3
|
56 |
-
generator = torch.Generator(device=
|
57 |
images = pipe(
|
58 |
prompt=prompt,
|
59 |
image=image,
|
|
|
37 |
return PIL.Image.open(BytesIO(response.content)).convert("RGB")
|
38 |
|
39 |
model_path = "runwayml/stable-diffusion-inpainting"
|
40 |
+
device = "cpu" # "cuda"
|
41 |
|
42 |
pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
43 |
model_path,
|
44 |
+
# revision="fp16",
|
45 |
+
# torch_dtype=torch.float16,
|
46 |
use_auth_token=True
|
47 |
+
).to(device)
|
48 |
|
49 |
img_url = "https://cdn.faire.com/fastly/893b071985d70819da5f0d485f1b1bb97ee4f16a6e14ef1bdd4a086b3588be58.png" # wino
|
50 |
image = download_image(img_url).resize((512, 512))
|
|
|
54 |
|
55 |
guidance_scale=7.5
|
56 |
num_samples = 3
|
57 |
+
generator = torch.Generator(device=device).manual_seed(0) # change the seed to get different results
|
58 |
images = pipe(
|
59 |
prompt=prompt,
|
60 |
image=image,
|