import inferlessURL = "https://<model>.default.model-v2.inferless.com/v2/models/<model>/versions/1/infer"API_KEY = "76e51......39b57"data = {"prompt" : "a horse near a beach"}# This call is synced until the response is returnedresult = inferless.call(URL, API_KEY, data)
inputs (Optional) - Model Input Data in Inference Protocol format, data should not be given is this is given
**callback - The callback function will be called after receiving the response.
callback function should have two params: callback(error, response)
error - any error resulting while calling the inferless endpoint
response - response from the inferless endpoint
Copy
import inferlessURL = "https://<model>.default.model-v2.inferless.com/v2/models/<model>/versions/1/infer"API_KEY = "76e51......39b57"data = {"prompt" : "a horse near a beach"}# callback function which writes the response to a filedef callback_func(e, response): # e is the error object # response is the response object print(response)# This is not a blocking call and runs in the background and callback function is triggered to write the endpoint response to a fileinferless.call_async(URL, KEY, DATA, callback_func)