Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,13 +43,13 @@ def pred_func(image, prompt):
|
|
43 |
if type(out) == type({}):
|
44 |
#return out["spiga_seg"]
|
45 |
control_image = out["spiga_seg"]
|
46 |
-
if type(
|
47 |
-
|
48 |
elif hasattr(image, "shape"):
|
49 |
-
|
50 |
else:
|
51 |
-
|
52 |
-
|
53 |
|
54 |
generator = torch.manual_seed(0)
|
55 |
image = pipe(
|
|
|
43 |
if type(out) == type({}):
|
44 |
#return out["spiga_seg"]
|
45 |
control_image = out["spiga_seg"]
|
46 |
+
if type(image) == type("") and os.path.exists(image):
|
47 |
+
image = Image.open(image).convert("RGB")
|
48 |
elif hasattr(image, "shape"):
|
49 |
+
image = Image.fromarray(image).convert("RGB")
|
50 |
else:
|
51 |
+
image = image.convert("RGB")
|
52 |
+
image = image.resize((512, 512))
|
53 |
|
54 |
generator = torch.manual_seed(0)
|
55 |
image = pipe(
|