Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,8 @@ import numpy as np
|
|
| 4 |
import random
|
| 5 |
import spaces
|
| 6 |
import torch
|
| 7 |
-
from diffusers import DiffusionPipeline
|
|
|
|
| 8 |
from huggingface_hub import InferenceClient
|
| 9 |
|
| 10 |
dtype = torch.bfloat16
|
|
@@ -17,7 +18,9 @@ print('sdxl loaded')
|
|
| 17 |
|
| 18 |
"kandinsky-community/kandinsky-2-2-decoder"
|
| 19 |
#pipeline2Image = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtypes=torch.bfloat16).to(device)
|
| 20 |
-
pipeline2Image = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", torch_dtypes=torch.bfloat16).to(device)
|
|
|
|
|
|
|
| 21 |
print("pipeline 2 image loaded")
|
| 22 |
|
| 23 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 4 |
import random
|
| 5 |
import spaces
|
| 6 |
import torch
|
| 7 |
+
#from diffusers import DiffusionPipeline
|
| 8 |
+
from diffusers import AutoPipelineForImage2Image
|
| 9 |
from huggingface_hub import InferenceClient
|
| 10 |
|
| 11 |
dtype = torch.bfloat16
|
|
|
|
| 18 |
|
| 19 |
"kandinsky-community/kandinsky-2-2-decoder"
|
| 20 |
#pipeline2Image = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", torch_dtypes=torch.bfloat16).to(device)
|
| 21 |
+
#pipeline2Image = DiffusionPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", torch_dtypes=torch.bfloat16).to(device)
|
| 22 |
+
pipeline2Image = AutoPipelineForImage2Image.from_pretrained("kandinsky-community/kandinsky-2-2-decoder", torch_dtype=dtype)
|
| 23 |
+
pipeline2Image.enable_model_cpu_offload()
|
| 24 |
print("pipeline 2 image loaded")
|
| 25 |
|
| 26 |
MAX_SEED = np.iinfo(np.int32).max
|