Leverage your custom trained model for cloud hosted inference


See the documentation page for Roboflow's one-click training solution.

After training, your model will post to an endpoint for inference.


There are multiple ways to use your trained model for inference.

  • You can POST a base64-encoded image to your endpoint with curl or pass a URL via the query string.

  • We have a sample web app you can use as an example for building your endpoint into a custom application.

  • We have sample Python code for making requests to your inference endpoint.

Inference Parameters

  • URL

    • The URL to POST to

    • example


  • format

    • The inference format to return

      • "image" - displays an image with prediction annotations

      • "json" - returns json structure of prediction classes and coordinates

  • labels

    • Display prediction labels for image output format

      • true - don't display labels on prediction images

      • false - display labels on prediction images

  • stroke

    • Display prediction bounding boxes for image output format

      • 0-N - pixel width of prediction boxes

  • confidence

    • Filter model predictions based on estimated confidence. Higher confidence means less, but more precise predictions

      • Preset: 40

      • Range: 0-99

  • overlap

    • Filter out overlapping predicted bounding boxes of the same class. If this percentage overlaps the higher confidence prediction will be made

      • Preset 30

      • Range: 0 - 100

  • classes

    • Filter prediction classes to only include those specified

      • Preset: []

      • example: ['dog', 'cat']

Curl Command

You can post to the inference API via a simple curl command:

Jacobs-MacBook-Pro:train wolf$ base64 chanterelle_02_jpg.rf.38ab9a1ba80594222de3d869f69bcb45.jpg | curl -d @- '[YOUR TOKEN HERE]&confidence=20&format=json'
{"predictions":[{"x": 225.0, "y": 410.5, "width": 450, "height": 509, "class": "chanterelle", "confidence": 0.318}, {"x": 815.0, "y": 414.0, "width": 418, "height": 438, "class": "chanterelle", "confidence": 0.217}]}

Java Script - The Example Web App

The easiest way to familiarize yourself with the inference endpoint is to visit the Example Web App. To use the Web App, simply input your model and access_token. These will be pre-filled for you after training completes.

Then select an image via Choose File. After you have chosen the settings you want, click Run Inference.

Using the Roboflow Inference endpoint to detect mushrooms

On the left, you will see example JavaScript code for posting a base64-encoded image to the inference endpoint.

Within the form portion of the Web App, you can experiment with changing different API parameters when posting to the API.

Python Example

Here we provide an example of sending a POST request to the inference endpoint using the python requests library.

Define the url destination

parts = []
endpoint = '[YOUR ENPOINT HERE]'
format = '?format=json'
access_token = '&access_token=[YOUR TOKEN HERE]'
url = ''.join(parts)

Convert the image to base64 and send the request

import requests
import base64
import io
from PIL import Image
image ='example.jpg')
buffered = io.BytesIO()
image = image.convert("RGB"), quality=90, format="JPEG")
img_str = base64.b64encode(buffered.getvalue())
img_str = img_str.decode("ascii")
headers = {'accept': 'application/json'}
r =, data=img_str, headers=headers)