Spaces:
Runtime error
Runtime error
Update requirements.txt
#14
by
justinpinkney
- opened
- app.py +3 -4
- requirements.txt +4 -2
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
-
from
|
| 6 |
|
| 7 |
def main(
|
| 8 |
input_im,
|
|
@@ -21,7 +21,7 @@ def main(
|
|
| 21 |
)
|
| 22 |
|
| 23 |
images = []
|
| 24 |
-
for i, image in enumerate(images_list["
|
| 25 |
if(images_list["nsfw_content_detected"][i]):
|
| 26 |
safe_image = Image.open(r"unsafe.png")
|
| 27 |
images.append(safe_image)
|
|
@@ -57,9 +57,8 @@ More details on the method and training will come in a future blog post.
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 60 |
-
pipe =
|
| 61 |
"lambdalabs/sd-image-variations-diffusers",
|
| 62 |
-
revision="273115e88df42350019ef4d628265b8c29ef4af5",
|
| 63 |
)
|
| 64 |
pipe = pipe.to(device)
|
| 65 |
|
|
|
|
| 2 |
import torch
|
| 3 |
from PIL import Image
|
| 4 |
|
| 5 |
+
from diffusers import StableDiffusionImageVariationPipeline
|
| 6 |
|
| 7 |
def main(
|
| 8 |
input_im,
|
|
|
|
| 21 |
)
|
| 22 |
|
| 23 |
images = []
|
| 24 |
+
for i, image in enumerate(images_list["images"]):
|
| 25 |
if(images_list["nsfw_content_detected"][i]):
|
| 26 |
safe_image = Image.open(r"unsafe.png")
|
| 27 |
images.append(safe_image)
|
|
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 60 |
+
pipe = StableDiffusionImageVariationPipeline.from_pretrained(
|
| 61 |
"lambdalabs/sd-image-variations-diffusers",
|
|
|
|
| 62 |
)
|
| 63 |
pipe = pipe.to(device)
|
| 64 |
|
requirements.txt
CHANGED
|
@@ -1,3 +1,5 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
--extra-index-url https://download.pytorch.org/whl/cu113
|
| 3 |
-
torch
|
|
|
|
|
|
| 1 |
+
diffusers
|
| 2 |
+
transformers
|
| 3 |
--extra-index-url https://download.pytorch.org/whl/cu113
|
| 4 |
+
torch
|
| 5 |
+
torchvision
|