Ai
11 Star 85 Fork 42

Gitee 极速下载/compreface

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/exadel-inc/CompreFace
克隆/下载
tutorial_demo.html 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function saveNewImageToFaceCollection(elem) {
let subject = encodeURIComponent(document.getElementById("subject").value);
let apiKey = document.getElementById("apiKey").value;
let formData = new FormData();
let photo = elem.files[0];
formData.append("file", photo);
fetch('http://localhost:8000/api/v1/recognition/faces/?subject=' + subject,
{
method: "POST",
headers: {
"x-api-key": apiKey
},
body: formData
}
).then(r => r.json()).then(
function (data) {
console.log('New example was saved', data);
})
.catch(function (error) {
alert('Request failed: ' + JSON.stringify(error));
});
}
function recognizeFace(elem) {
let apiKey = document.getElementById("apiKey").value;
let formData = new FormData();
let photo = elem.files[0];
formData.append("file", photo);
fetch('http://localhost:8000/api/v1/recognition/recognize',
{
method: "POST",
headers: {
"x-api-key": apiKey
},
body: formData
}
).then(r => r.json()).then(
function (data) {
document.getElementById("result").innerHTML = JSON.stringify(data);
})
.catch(function (error) {
alert('Request failed: ' + JSON.stringify(error));
});
}
</script>
<title>test</title>
</head>
<body>
<label for="apiKey">API key:</label><input id="apiKey" />
<div></div>
<label for="subject">Subject:</label><input id="subject" />
<div>Click to add photo:</div>
<input type=file id="newFace" onchange="saveNewImageToFaceCollection(this)" />
<div>Click to recognize photo</div>
<input type=file id="recognizeFace" onchange="recognizeFace(this)" />
<div>Result:</div>
<div id="result"></div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mirrors/compreface.git
git@gitee.com:mirrors/compreface.git
mirrors
compreface
compreface
master

搜索帮助