Spaces:
Build error
Build error
Commit ·
ca559d4
1
Parent(s): 1b68d22
General clean up
Browse files- geo_painting.py +1 -8
geo_painting.py
CHANGED
|
@@ -1,15 +1,13 @@
|
|
| 1 |
import torch
|
|
|
|
| 2 |
from diffusers import (
|
| 3 |
StableDiffusionControlNetPipeline,
|
| 4 |
UniPCMultistepScheduler,
|
| 5 |
ControlNetModel
|
| 6 |
)
|
| 7 |
-
from diffusers.utils import load_image
|
| 8 |
-
from PIL import Image
|
| 9 |
|
| 10 |
|
| 11 |
class GeoPainting:
|
| 12 |
-
|
| 13 |
DEFAULT_CONTROLNET_MODEL = "lllyasviel/control_v11f1p_sd15_depth"
|
| 14 |
DEFAULT_DIFFUSER_MODEL = "geospatial_diffuser"
|
| 15 |
|
|
@@ -25,16 +23,11 @@ class GeoPainting:
|
|
| 25 |
)
|
| 26 |
self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
|
| 27 |
if torch.cuda.is_available():
|
| 28 |
-
print(":::::::CUDA AVAILABLE::GPU:HUGGINGFACE:::::::")
|
| 29 |
self.pipe.enable_model_cpu_offload()
|
| 30 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 31 |
|
| 32 |
def generate_painting(self, input_promp, control_image):
|
| 33 |
-
print(":::::::::::::::::")
|
| 34 |
-
print(type(control_image))
|
| 35 |
image = Image.fromarray(control_image.astype('uint8'))
|
| 36 |
-
print(type(image))
|
| 37 |
-
|
| 38 |
output = self.pipe(
|
| 39 |
input_promp,
|
| 40 |
image,
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from PIL import Image
|
| 3 |
from diffusers import (
|
| 4 |
StableDiffusionControlNetPipeline,
|
| 5 |
UniPCMultistepScheduler,
|
| 6 |
ControlNetModel
|
| 7 |
)
|
|
|
|
|
|
|
| 8 |
|
| 9 |
|
| 10 |
class GeoPainting:
|
|
|
|
| 11 |
DEFAULT_CONTROLNET_MODEL = "lllyasviel/control_v11f1p_sd15_depth"
|
| 12 |
DEFAULT_DIFFUSER_MODEL = "geospatial_diffuser"
|
| 13 |
|
|
|
|
| 23 |
)
|
| 24 |
self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config)
|
| 25 |
if torch.cuda.is_available():
|
|
|
|
| 26 |
self.pipe.enable_model_cpu_offload()
|
| 27 |
self.pipe.enable_xformers_memory_efficient_attention()
|
| 28 |
|
| 29 |
def generate_painting(self, input_promp, control_image):
|
|
|
|
|
|
|
| 30 |
image = Image.fromarray(control_image.astype('uint8'))
|
|
|
|
|
|
|
| 31 |
output = self.pipe(
|
| 32 |
input_promp,
|
| 33 |
image,
|