Skip to content

Instantly share code, notes, and snippets.

@dkatz23238
Created March 11, 2023 16:53
Show Gist options
  • Save dkatz23238/355153cd162886ce51f61b5746d6a2f2 to your computer and use it in GitHub Desktop.
Save dkatz23238/355153cd162886ce51f61b5746d6a2f2 to your computer and use it in GitHub Desktop.
Calling SML On Premises
import requests
# Load the image
img = open("image.png", "rb")
# Send image to the /predict endpoint
response = requests.post(
"http://localhost:8001/predict",
files={
"document_image": img
}
)
img.close()
print(test_response.json())
@otaviomguerra
Copy link

otaviomguerra commented Jun 12, 2023

For self signed certificate the code becomes:

import requests

# Load the image
img = open("image.png", "rb")

# Send image to the /predict endpoint
response = requests.post(
    "https://localhost:8001/predict",
    files={
        "document_image": img
    },
    verify=False
)

img.close()
print(response.json())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment