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)