Update to runway SD 1.5
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from diffusers import
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import imageio
|
@@ -15,7 +15,7 @@ YOUR_TOKEN=MY_SECRET_TOKEN
|
|
15 |
|
16 |
device="cpu"
|
17 |
|
18 |
-
pipe = StableDiffusionInpaintPipeline.from_pretrained("
|
19 |
pipe.to(device)
|
20 |
|
21 |
source_img = gr.Image(source="upload", type="numpy", tool="sketch", elem_id="source_container");
|
@@ -41,7 +41,7 @@ def predict(source_img, prompt):
|
|
41 |
images_list = pipe([prompt] * 2, init_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["
|
45 |
if(images_list["nsfw_content_detected"][i]):
|
46 |
images.append(safe_image)
|
47 |
else:
|
|
|
1 |
+
from diffusers import DiffusionPipeline
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import imageio
|
|
|
15 |
|
16 |
device="cpu"
|
17 |
|
18 |
+
pipe = StableDiffusionInpaintPipeline.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");
|
|
|
41 |
images_list = pipe([prompt] * 2, init_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"]):
|
45 |
if(images_list["nsfw_content_detected"][i]):
|
46 |
images.append(safe_image)
|
47 |
else:
|