Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ YOUR_TOKEN=MY_SECRET_TOKEN
|
|
15 |
|
16 |
device="cpu"
|
17 |
|
18 |
-
pipe =
|
19 |
pipe.to(device)
|
20 |
|
21 |
source_img = gr.Image(source="upload", type="numpy", tool="sketch", elem_id="source_container");
|
@@ -38,7 +38,7 @@ def predict(source_img, prompt):
|
|
38 |
mask = resize(512, "data_mask.png")
|
39 |
mask.save("mask.png")
|
40 |
|
41 |
-
images_list = pipe([prompt] * 2,
|
42 |
images = []
|
43 |
safe_image = Image.open(r"unsafe.png")
|
44 |
for i, image in enumerate(images_list["images"]):
|
|
|
15 |
|
16 |
device="cpu"
|
17 |
|
18 |
+
pipe = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-inpainting", use_auth_token=YOUR_TOKEN)
|
19 |
pipe.to(device)
|
20 |
|
21 |
source_img = gr.Image(source="upload", type="numpy", tool="sketch", elem_id="source_container");
|
|
|
38 |
mask = resize(512, "data_mask.png")
|
39 |
mask.save("mask.png")
|
40 |
|
41 |
+
images_list = pipe([prompt] * 2, image=src, mask_image=mask, strength=0.75)
|
42 |
images = []
|
43 |
safe_image = Image.open(r"unsafe.png")
|
44 |
for i, image in enumerate(images_list["images"]):
|