vishnurrajeev011's picture
first commit
68a6918
Raw
History Blame Contribute Delete
711 Bytes
import requests
url = "http://localhost:7860/segment"
image_path = "input.png" # Replace with your local test image path
# Define the bounding box coordinates [xmin, ymin, xmax, ymax]
# Adjust these numbers to fit your test image's target area
payload = {"bbox": "[95, 255, 190, 350]"}
with open(image_path, "rb") as f:
files = {"file": f}
print("Sending request to API CALL...")
response = requests.post(url, data=payload, files=files)
if response.status_code == 200:
with open("local_test_result.png", "wb") as out:
out.write(response.content)
print("Success! Segmented image saved as 'local_test_result.png'")
else:
print(f"Error {response.status_code}: {response.text}")