Views
No views yet
edge_sam_3x_encoder.onnx - Image encoder (1024x1024 input)edge_sam_3x_decoder.onnx - Mask decoder with prompt support1import requests
2import base64
3
4# Encode your image
5with open("image.jpg", "rb") as f:
6 image_b64 = base64.b64encode(f.read()).decode()
7
8# Make request
9response = requests.post(
10 "https://YOUR-ENDPOINT-URL",
11 json={
12 "inputs": image_b64,
13 "parameters": {
14 "point_coords": [[512, 512]], # Click point in 1024x1024 space
15 "point_labels": [1], # 1 = foreground, 0 = background
16 "return_mask_image": True
17 }
18 }
19)
20
21result = response.json()1[
2 {
3 "mask_shape": [1024, 1024],
4 "has_object": true,
5 "mask": "<base64_encoded_png>"
6 }
7][x, y] coordinates in 1024x1024 space (optional)[x1, y1, x2, y2] (optional, not yet implemented)true)[512, 512].1# Install dependencies
2pip install -r requirements.txt
3
4# Run test script
5python test_handler.pytest_input.png - Test image with red circletest_output_mask.png - Generated segmentation masktest_output_overlay.png - Overlay visualization/ 255.0)