Run an Instant Model

You can run Roboflow Instant models using the Python SDK and the Serverless Hosted API V2.

To run an Instant model, use the following code:

from inference_sdk import InferenceHTTPClient, InferenceConfiguration

CLIENT = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key="<Your API Key>",
    
)

configuration = InferenceConfiguration(
    confidence_threshold=0.95
)

CLIENT.configure(configuration)

result = client.infer("image.jpeg", model_id="model-id/1")

print(result)

Above, specify your model ID and API key.

This code will run your model and return the results.

Confidence threshold can be sensitive for Instant models. An optimal confidence depends on the number of images the model has been trained on. Optimal confidence thresholds usually range from 0.85 to 0.99.

Last updated

Was this helpful?