Spaces:
Running
on
Zero
Running
on
Zero
root
commited on
Commit
•
e3257fd
1
Parent(s):
00c2c78
cog fixes
Browse files- predict.py +13 -5
predict.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
|
4 |
from cog import BasePredictor, Input, Path
|
5 |
from omni_zero import OmniZeroSingle
|
|
|
6 |
|
7 |
class Predictor(BasePredictor):
|
8 |
def setup(self):
|
@@ -32,6 +33,13 @@ class Predictor(BasePredictor):
|
|
32 |
depth_image_strength: float = Input(description="Depth image strength for the model, if not supplied the composition image will be used for depth", default=0.5, ge=0.0, le=1.0),
|
33 |
) -> Path:
|
34 |
"""Run a single prediction on the model"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
images = self.omni_zero.generate(
|
36 |
seed=seed,
|
37 |
prompt=prompt,
|
@@ -39,15 +47,15 @@ class Predictor(BasePredictor):
|
|
39 |
guidance_scale=guidance_scale,
|
40 |
number_of_images=number_of_images,
|
41 |
number_of_steps=number_of_steps,
|
42 |
-
base_image=
|
43 |
base_image_strength=base_image_strength,
|
44 |
-
composition_image=
|
45 |
composition_image_strength=composition_image_strength,
|
46 |
-
style_image=
|
47 |
style_image_strength=style_image_strength,
|
48 |
-
identity_image=
|
49 |
identity_image_strength=identity_image_strength,
|
50 |
-
depth_image=
|
51 |
depth_image_strength=depth_image_strength,
|
52 |
)
|
53 |
|
|
|
3 |
|
4 |
from cog import BasePredictor, Input, Path
|
5 |
from omni_zero import OmniZeroSingle
|
6 |
+
from PIL import Image
|
7 |
|
8 |
class Predictor(BasePredictor):
|
9 |
def setup(self):
|
|
|
33 |
depth_image_strength: float = Input(description="Depth image strength for the model, if not supplied the composition image will be used for depth", default=0.5, ge=0.0, le=1.0),
|
34 |
) -> Path:
|
35 |
"""Run a single prediction on the model"""
|
36 |
+
|
37 |
+
base_image = Image.open(base_image)
|
38 |
+
composition_image = Image.open(composition_image)
|
39 |
+
style_image = Image.open(style_image)
|
40 |
+
identity_image = Image.open(identity_image)
|
41 |
+
if depth_image is not None:
|
42 |
+
depth_image = Image.open(depth_image)
|
43 |
images = self.omni_zero.generate(
|
44 |
seed=seed,
|
45 |
prompt=prompt,
|
|
|
47 |
guidance_scale=guidance_scale,
|
48 |
number_of_images=number_of_images,
|
49 |
number_of_steps=number_of_steps,
|
50 |
+
base_image=base_image,
|
51 |
base_image_strength=base_image_strength,
|
52 |
+
composition_image=composition_image,
|
53 |
composition_image_strength=composition_image_strength,
|
54 |
+
style_image=style_image,
|
55 |
style_image_strength=style_image_strength,
|
56 |
+
identity_image=identity_image,
|
57 |
identity_image_strength=identity_image_strength,
|
58 |
+
depth_image=depth_image,
|
59 |
depth_image_strength=depth_image_strength,
|
60 |
)
|
61 |
|