Commit
·
e6c7107
1
Parent(s):
89932ef
Update requirements.txt (#14)
Browse files- Update requirements.txt (741cfed93a39c40b3fbc6e2c3054bcc7c7712794)
- Update app.py (217632b709fc80599647648959f5fd2d61ea8068)
- Update app.py (8d6b2bfa051de3dbb4ee9370d830567350ea09dc)
- 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
|