- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2024 09:21 AM
I am trying to get a prediction by querying the ML Endpoint on Azure Databricks with R.
I'm not sure what is the format of the expected data. Is there any other problem with this code?
Thanks!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2024 07:32 PM
Hi Kaniz,
I was able to find the solution. You should post this in the examples when you click "Query Endpoint"
You only have code for Browser, Curl, Python, SQL. You should add a tab for R
Here is the solution:
library(httr)
url <- "https://adb-********.azuredatabricks.net/serving-endpoints/********/invocations"
db_token="dap*******"
headers <- add_headers('Authorization'==paste('Bearer', db_token, sep=' '),
"Content-Type" = "application/json")
data='{"dataframe_split": {"columns": ["***columnName1String***", "***ColumnName2Integer****"], "data": [["val11", val12], ["val21", val22], ["val31", val32]]}}'
response= POST(url,headers,body=data)
results <- content(response, "parsed")