106 lines
4.5 KiB
HTML
106 lines
4.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link rel="stylesheet" href="static/styleappy.css">
|
|
<script>
|
|
async function fetchListFaces() {
|
|
const url = document.getElementById('list_faces_url').value;
|
|
const response = await fetch('/list_faces', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ url: url })
|
|
});
|
|
const result = await response.json();
|
|
document.getElementById('list_faces_result').textContent = JSON.stringify(result, null, 2);
|
|
}
|
|
|
|
async function fetchGetImage() {
|
|
const base_url = document.getElementById('get_image_url').value;
|
|
const bucket = document.getElementById('bucket').value;
|
|
const image_path = document.getElementById('image_path').value;
|
|
|
|
const response = await fetch('/get_image', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ base_url: base_url, bucket: bucket, image_path: image_path })
|
|
});
|
|
|
|
if (response.ok) {
|
|
const blob = await response.blob();
|
|
const imgUrl = URL.createObjectURL(blob);
|
|
const imageElement = document.getElementById('get_image_result');
|
|
imageElement.src = imgUrl;
|
|
imageElement.style.display = 'block'; // Exibe a imagem
|
|
} else {
|
|
document.getElementById('get_image_result').textContent = 'Erro ao buscar a imagem.';
|
|
document.getElementById('get_image_result').style.display = 'none';
|
|
}
|
|
}
|
|
async function fetchUpdateName() {
|
|
const url = document.getElementById('update_name_url').value;
|
|
const userID = document.getElementById('userID').value;
|
|
const new_name = document.getElementById('new_name').value;
|
|
|
|
const response = await fetch('/update_name', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ url: url,userID:userID,new_name:new_name })
|
|
});
|
|
const result = await response.json();
|
|
document.getElementById('update_name_result').textContent = JSON.stringify(result, null, 2);
|
|
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div class="title">API Test Interface</div>
|
|
<div class="container">
|
|
<div class="form-container">
|
|
<form onsubmit="event.preventDefault(); fetchListFaces();">
|
|
<h2>Test /manager/list/faces</h2>
|
|
<label for="list_faces_url">List Faces URL:</label>
|
|
<input type="text" id="list_faces_url" placeholder="http://172.17.0.5:5001/manager/list/faces" required>
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
<pre id="list_faces_result"></pre>
|
|
</div>
|
|
|
|
<div class="form-container">
|
|
<form onsubmit="event.preventDefault(); fetchGetImage();">
|
|
<h2>Test /manager/get/image</h2>
|
|
<label for="get_image_url">Base URL:</label>
|
|
<input type="text" id="get_image_url" placeholder="http://172.17.0.5:5001/manager/get/image" required>
|
|
|
|
<label for="bucket">Bucket:</label>
|
|
<input type="text" id="bucket" required>
|
|
|
|
<label for="image_path">Image Path:</label>
|
|
<input type="text" id="image_path" required>
|
|
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
<img id="get_image_result" style="display:none;" alt="Image Result">
|
|
</div>
|
|
<div class="form-container">
|
|
<form onsubmit="event.preventDefault(); fetchUpdateName();">
|
|
<h2>Test /manager/update_name</h2>
|
|
|
|
<label for="update_name">Change Name URL:</label>
|
|
<input type="text" id="update_name_url" placeholder="http://172.17.0.5:5001/manager/update_name" required>
|
|
|
|
<label for="userID">userID:</label>
|
|
<input type="text" id="userID" required>
|
|
|
|
<label for="new_name">new_name:</label>
|
|
<input type="text" id="new_name" required>
|
|
|
|
<button type="submit">Submit</button>
|
|
</form>
|
|
<pre id="update_name_result"></pre>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|