Skip to content

Commit 83b560a

Browse files
authored
Merge pull request #108686 from craigcaseyMSFT/vcraic0322
fix AM build issues
2 parents 7bfbc29 + 8471d59 commit 83b560a

File tree

2 files changed

+58
-58
lines changed

2 files changed

+58
-58
lines changed

articles/machine-learning/how-to-consume-web-service.md

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The [azureml.core.Webservice](https://docs.microsoft.com/python/api/azureml-core
4242
* `auth_enabled` - If key authentication is enabled, `True`; otherwise, `False`.
4343
* `token_auth_enabled` - If token authentication is enabled, `True`; otherwise, `False`.
4444
* `scoring_uri` - The REST API address.
45-
* `swagger_uri` - The address of the OpenAPI specification. This URI is available if you enabled automatic schema generation. For more information, see [Deploy models with Azure Machine Learning](how-to-deploy-and-where.md#schema).
45+
* `swagger_uri` - The address of the OpenAPI specification. This URI is available if you enabled automatic schema generation. For more information, see [Deploy models with Azure Machine Learning](how-to-deploy-and-where.md#optional-define-model-web-service-schema).
4646

4747
There are a three ways to retrieve this information for deployed web services:
4848

@@ -274,47 +274,47 @@ This example demonstrates how to use Go to call the web service created from the
274274
package main
275275

276276
import (
277-
"bytes"
278-
"encoding/json"
279-
"fmt"
280-
"io/ioutil"
281-
"net/http"
277+
"bytes"
278+
"encoding/json"
279+
"fmt"
280+
"io/ioutil"
281+
"net/http"
282282
)
283283

284284
// Features for this model are an array of decimal values
285285
type Features []float64
286286

287287
// The web service input can accept multiple sets of values for scoring
288288
type InputData struct {
289-
Data []Features `json:"data",omitempty`
289+
Data []Features `json:"data",omitempty`
290290
}
291291

292292
// Define some example data
293293
var exampleData = []Features{
294-
[]float64{
295-
0.0199132141783263,
296-
0.0506801187398187,
297-
0.104808689473925,
298-
0.0700725447072635,
299-
-0.0359677812752396,
300-
-0.0266789028311707,
301-
-0.0249926566315915,
302-
-0.00259226199818282,
303-
0.00371173823343597,
304-
0.0403433716478807,
305-
},
306-
[]float64{
307-
-0.0127796318808497,
308-
-0.044641636506989,
309-
0.0606183944448076,
310-
0.0528581912385822,
311-
0.0479653430750293,
312-
0.0293746718291555,
313-
-0.0176293810234174,
314-
0.0343088588777263,
315-
0.0702112981933102,
316-
0.00720651632920303,
317-
},
294+
[]float64{
295+
0.0199132141783263,
296+
0.0506801187398187,
297+
0.104808689473925,
298+
0.0700725447072635,
299+
-0.0359677812752396,
300+
-0.0266789028311707,
301+
-0.0249926566315915,
302+
-0.00259226199818282,
303+
0.00371173823343597,
304+
0.0403433716478807,
305+
},
306+
[]float64{
307+
-0.0127796318808497,
308+
-0.044641636506989,
309+
0.0606183944448076,
310+
0.0528581912385822,
311+
0.0479653430750293,
312+
0.0293746718291555,
313+
-0.0176293810234174,
314+
0.0343088588777263,
315+
0.0702112981933102,
316+
0.00720651632920303,
317+
},
318318
}
319319

320320
// Set to the URI for your service
@@ -323,32 +323,32 @@ var serviceUri string = "<your web service URI>"
323323
var authKey string = "<your key or token>"
324324

325325
func main() {
326-
// Create the input data from example data
327-
jsonData := InputData{
328-
Data: exampleData,
329-
}
330-
// Create JSON from it and create the body for the HTTP request
331-
jsonValue, _ := json.Marshal(jsonData)
332-
body := bytes.NewBuffer(jsonValue)
333-
334-
// Create the HTTP request
335-
client := &http.Client{}
336-
request, err := http.NewRequest("POST", serviceUri, body)
337-
request.Header.Add("Content-Type", "application/json")
338-
339-
// These next two are only needed if using an authentication key
340-
bearer := fmt.Sprintf("Bearer %v", authKey)
341-
request.Header.Add("Authorization", bearer)
342-
343-
// Send the request to the web service
344-
resp, err := client.Do(request)
345-
if err != nil {
346-
fmt.Println("Failure: ", err)
347-
}
348-
349-
// Display the response received
350-
respBody, _ := ioutil.ReadAll(resp.Body)
351-
fmt.Println(string(respBody))
326+
// Create the input data from example data
327+
jsonData := InputData{
328+
Data: exampleData,
329+
}
330+
// Create JSON from it and create the body for the HTTP request
331+
jsonValue, _ := json.Marshal(jsonData)
332+
body := bytes.NewBuffer(jsonValue)
333+
334+
// Create the HTTP request
335+
client := &http.Client{}
336+
request, err := http.NewRequest("POST", serviceUri, body)
337+
request.Header.Add("Content-Type", "application/json")
338+
339+
// These next two are only needed if using an authentication key
340+
bearer := fmt.Sprintf("Bearer %v", authKey)
341+
request.Header.Add("Authorization", bearer)
342+
343+
// Send the request to the web service
344+
resp, err := client.Do(request)
345+
if err != nil {
346+
fmt.Println("Failure: ", err)
347+
}
348+
349+
// Display the response received
350+
respBody, _ := ioutil.ReadAll(resp.Body)
351+
fmt.Println(string(respBody))
352352
}
353353
```
354354

articles/stream-analytics/machine-learning-udf.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following table describes each property of Azure ML Service functions in Str
5353

5454
## Supported input parameters
5555

56-
When your Stream Analytics query invokes an Azure Machine Learning UDF, the job creates a JSON serialized request to the web service. The request is based on a model-specific schema. You have to provide a sample input and output in your scoring script to [automatically generate a schema](../machine-learning/how-to-deploy-and-where.md#optional-automatic-schema-generation). The schema allows Stream Analytics to construct the JSON serialized request for any of the supported data types such as numpy, pandas and PySpark. Multiple input events can be batched together in a single request.
56+
When your Stream Analytics query invokes an Azure Machine Learning UDF, the job creates a JSON serialized request to the web service. The request is based on a model-specific schema. You have to provide a sample input and output in your scoring script to [automatically generate a schema](../machine-learning/how-to-deploy-and-where.md#optional-define-model-web-service-schema). The schema allows Stream Analytics to construct the JSON serialized request for any of the supported data types such as numpy, pandas and PySpark. Multiple input events can be batched together in a single request.
5757

5858
The following Stream Analytics query is an example of how to invoke an Azure Machine Learning UDF:
5959

0 commit comments

Comments
 (0)