InferenceHTTPClient supports core models hosted by Inference. Some of these models can be used on the Roboflow hosted inference platform (use https://serverless.roboflow.com as the URL); others can be deployed locally (usually the local server is available at http://localhost:9001).
CLIP
from inference_sdk import InferenceHTTPClient
CLIENT = InferenceHTTPClient(
api_url="http://localhost:9001", # or "https://serverless.roboflow.com" to use hosted serving
api_key="ROBOFLOW_API_KEY"
)
CLIENT.get_clip_image_embeddings(inference_input="./my_image.jpg") # single image request
CLIENT.get_clip_image_embeddings(inference_input=["./my_image.jpg", "./other_image.jpg"]) # batch image request
CLIENT.get_clip_text_embeddings(text="some") # single text request
CLIENT.get_clip_text_embeddings(text=["some", "other"]) # other text request
CLIENT.clip_compare(
subject="./my_image.jpg",
prompt=["fox", "dog"],
)The CLIENT.clip_compare(...) method allows you to compare different combinations of subject_type and prompt_type:
(image, image)(default)(image, text)(text, image)(text, text)
Async methods are also available:
from inference_sdk import InferenceHTTPClient
CLIENT = InferenceHTTPClient(
api_url="http://localhost:9001", # or "https://serverless.roboflow.com" to use hosted serving
api_key="ROBOFLOW_API_KEY"
)
async def see_async_method():
await CLIENT.get_clip_image_embeddings_async(inference_input="./my_image.jpg") # single image request
await CLIENT.get_clip_image_embeddings_async(inference_input=["./my_image.jpg", "./other_image.jpg"]) # batch image request
await CLIENT.get_clip_text_embeddings_async(text="some") # single text request
await CLIENT.get_clip_text_embeddings_async(text=["some", "other"]) # other text request
await CLIENT.clip_compare_async(
subject="./my_image.jpg",
prompt=["fox", "dog"],
)See the CLIP model reference for details about the model itself.
DocTR
from inference_sdk import InferenceHTTPClient
CLIENT = InferenceHTTPClient(
api_url="http://localhost:9001", # or "https://serverless.roboflow.com" to use hosted serving
api_key="ROBOFLOW_API_KEY"
)
CLIENT.ocr_image(inference_input="./my_image.jpg") # single image request
CLIENT.ocr_image(inference_input=["./my_image.jpg", "./other_image.jpg"]) # batch image requestAsync equivalent: CLIENT.ocr_image_async(...). See the DocTR model reference for details.
Gaze (deprecated)
CLIENT.detect_gazes(...) and CLIENT.detect_gazes_async(...) have been removed along with the MediaPipe dependency. They now short-circuit client-side and raise inference_sdk.http.errors.FeatureDeprecatedError without issuing a network call. Contact Roboflow if you require this capability.