Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ from diffusers import KandinskyV22PriorPipeline, KandinskyV22ControlnetPipeline
|
|
13 |
|
14 |
accelerator = Accelerator(cpu=True)
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
-
depth_estimator =
|
17 |
pipe_prior = accelerator.prepare(KandinskyV22PriorPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float32))
|
18 |
pipe_prior.to("cpu")
|
19 |
pipe = accelerator.prepare(KandinskyV22ControlnetPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float32))
|
@@ -28,7 +28,7 @@ def make_hint(image, depth_estimator):
|
|
28 |
image = np.array(image)
|
29 |
image = image[:, :, None]
|
30 |
image = np.concatenate([image, image, image], axis=2)
|
31 |
-
|
32 |
##deputs = qrocessor(images=image, return_tensors="pt")
|
33 |
##with torch.no_grad():
|
34 |
## edputs = zodel(**deputs)
|
@@ -70,7 +70,7 @@ def make_hint(image, depth_estimator):
|
|
70 |
##image = (image * 127.5 + 127.5).clip(0, 255).astype(np.uint8)
|
71 |
##image = np.array(Image.fromarray(image))
|
72 |
##hint = torch.from_numpy(image).float() / 255.0
|
73 |
-
return
|
74 |
|
75 |
def plex(prompt,goof):
|
76 |
##goof = Image.open(goof).resize((512, 512))
|
|
|
13 |
|
14 |
accelerator = Accelerator(cpu=True)
|
15 |
MAX_SEED = np.iinfo(np.int32).max
|
16 |
+
depth_estimator = pipeline("depth-estimation", model="Intel/dpt-hybrid-midas", torch_dtype=torch.float32)
|
17 |
pipe_prior = accelerator.prepare(KandinskyV22PriorPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-prior", torch_dtype=torch.float32))
|
18 |
pipe_prior.to("cpu")
|
19 |
pipe = accelerator.prepare(KandinskyV22ControlnetPipeline.from_pretrained("kandinsky-community/kandinsky-2-2-controlnet-depth", torch_dtype=torch.float32))
|
|
|
28 |
image = np.array(image)
|
29 |
image = image[:, :, None]
|
30 |
image = np.concatenate([image, image, image], axis=2)
|
31 |
+
hint = Image.fromarray(image)
|
32 |
##deputs = qrocessor(images=image, return_tensors="pt")
|
33 |
##with torch.no_grad():
|
34 |
## edputs = zodel(**deputs)
|
|
|
70 |
##image = (image * 127.5 + 127.5).clip(0, 255).astype(np.uint8)
|
71 |
##image = np.array(Image.fromarray(image))
|
72 |
##hint = torch.from_numpy(image).float() / 255.0
|
73 |
+
return hint
|
74 |
|
75 |
def plex(prompt,goof):
|
76 |
##goof = Image.open(goof).resize((512, 512))
|