Update app.py
Browse files
app.py
CHANGED
@@ -25,9 +25,7 @@ def process_image(image, prompt, threshold, alpha_value, draw_rectangles):
|
|
25 |
|
26 |
pred = torch.sigmoid(preds)
|
27 |
mat = pred.cpu().numpy()
|
28 |
-
mask = Image.fromarray(np.uint8(mat * 255), "L")
|
29 |
-
mask = mask.resize(image.size)
|
30 |
-
mask = np.array(mask)[:, :, 0]
|
31 |
|
32 |
# normalize the mask
|
33 |
mask_min = mask.min()
|
@@ -43,6 +41,7 @@ def process_image(image, prompt, threshold, alpha_value, draw_rectangles):
|
|
43 |
|
44 |
return bmask
|
45 |
|
|
|
46 |
@app.route('/')
|
47 |
def index():
|
48 |
return "Hello, World! clipseg2"
|
|
|
25 |
|
26 |
pred = torch.sigmoid(preds)
|
27 |
mat = pred.cpu().numpy()
|
28 |
+
mask = Image.fromarray(np.uint8(mat[0, 0] * 255), "L") # Access the first channel of the output
|
|
|
|
|
29 |
|
30 |
# normalize the mask
|
31 |
mask_min = mask.min()
|
|
|
41 |
|
42 |
return bmask
|
43 |
|
44 |
+
|
45 |
@app.route('/')
|
46 |
def index():
|
47 |
return "Hello, World! clipseg2"
|