Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,9 +23,10 @@ def visualize_segmentation(image, prompts, preds):
|
|
23 |
|
24 |
def segment(img, clases):
|
25 |
print(img)
|
|
|
26 |
prompts = clases.split(',')
|
27 |
|
28 |
-
inputs = processor(text=prompts, images=[
|
29 |
|
30 |
outputs = model(**inputs)
|
31 |
preds = outputs.logits.unsqueeze(1)
|
|
|
23 |
|
24 |
def segment(img, clases):
|
25 |
print(img)
|
26 |
+
image = PIL.Image.fromarray(img, 'RGB')
|
27 |
prompts = clases.split(',')
|
28 |
|
29 |
+
inputs = processor(text=prompts, images=[image] * len(prompts), padding="max_length", return_tensors="pt")
|
30 |
|
31 |
outputs = model(**inputs)
|
32 |
preds = outputs.logits.unsqueeze(1)
|