-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaceanalysis.html
45 lines (43 loc) · 1.88 KB
/
faceanalysis.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<input type="file" id="filename" name="filename"/>
<button id="btnclick">Analyze Image</button>
<script type="text/javascript">
$(document).ready(function(){
$('#btnclick').click(function(){
var apiKey = "aee47afa91fe4130b011d16dbf4e3789";
var file = document.getElementById('filename').files[0];
var apiUrl = "https://api.projectoxford.ai/vision/v1.0/analyze?visualFeatures=Description&language=en";
var params = {
// Request parameters
"visualFeatures": "Tags",
"language": "en",
};
$.ajax({
url: apiUrl,
beforeSend: function (xhrObj) {
xhrObj.setRequestHeader("Content-Type", "application/octet-stream");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", apiKey);
},
type: "POST",
data: file,
processData: false
})
.done(function (response) {
//ProcessResult(response);
console.log(response);
})
.fail(function (error) {
//debugger;
//console.log(error.getAllResponseHeaders());
console.log(JSON.parse(error.responseText).message);
});
})
});
</script>
</body>
</html>