Spaces:
Running
Running
File size: 673 Bytes
15f423a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import requests
import os
# API endpoint
url = "https://wjbmattingly-kraken-api.hf.space/detect_lines"
# Path to the image file
image_path = os.path.join("data", "ms.jpg")
# Prepare the file for upload
files = {'file': ('ms.jpg', open(image_path, 'rb'), 'image/jpeg')}
# Send the POST request
response = requests.post(url, files=files)
# Check if the request was successful
if response.status_code == 200:
# Parse the JSON response
result = response.json()
# Print the detected lines
print("Detected lines:")
for line in result['lines']:
print(f"Line: {line}")
else:
print(f"Error: {response.status_code}")
print(response.text) |