Spaces:
Runtime error
Runtime error
Commit
·
0250758
1
Parent(s):
0e6779d
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from PIL import Image
|
|
|
|
| 4 |
|
| 5 |
from diffusers import StableDiffusionImageVariationPipeline
|
| 6 |
|
|
@@ -13,8 +14,21 @@ def main(
|
|
| 13 |
):
|
| 14 |
generator = torch.Generator(device=device).manual_seed(int(seed))
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
images_list = pipe(
|
| 17 |
-
n_samples
|
| 18 |
guidance_scale=scale,
|
| 19 |
num_inference_steps=steps,
|
| 20 |
generator=generator,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
from PIL import Image
|
| 4 |
+
from torchvision import transforms
|
| 5 |
|
| 6 |
from diffusers import StableDiffusionImageVariationPipeline
|
| 7 |
|
|
|
|
| 14 |
):
|
| 15 |
generator = torch.Generator(device=device).manual_seed(int(seed))
|
| 16 |
|
| 17 |
+
tform = transforms.Compose([
|
| 18 |
+
transforms.ToTensor(),
|
| 19 |
+
transforms.Resize(
|
| 20 |
+
(224, 224),
|
| 21 |
+
interpolation=transforms.InterpolationMode.BICUBIC,
|
| 22 |
+
antialias=False,
|
| 23 |
+
),
|
| 24 |
+
transforms.Normalize(
|
| 25 |
+
[0.48145466, 0.4578275, 0.40821073],
|
| 26 |
+
[0.26862954, 0.26130258, 0.27577711]),
|
| 27 |
+
])
|
| 28 |
+
inp = tform(input_im).to(device)
|
| 29 |
+
|
| 30 |
images_list = pipe(
|
| 31 |
+
inp.tile(n_samples, 1, 1, 1),
|
| 32 |
guidance_scale=scale,
|
| 33 |
num_inference_steps=steps,
|
| 34 |
generator=generator,
|