immich-automated-selfie-tim.../templates/index.html
2025-04-06 21:19:20 +02:00

144 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Immich Selfie Timelapse Tool</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f5f5f5;
margin: 0;
padding: 0;
}
.container {
max-width: 700px;
margin: 50px auto;
background: #fff;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
padding: 30px;
}
h1 {
text-align: center;
color: #333;
}
form {
margin-top: 20px;
}
label {
display: block;
margin-bottom: 10px;
color: #555;
}
input[type="text"],
input[type="number"],
select {
width: calc(100% - 20px);
padding: 8px 10px;
margin-top: 4px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}
button {
background: #28a745;
color: #fff;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 4px;
cursor: pointer;
display: block;
margin: 20px auto 0;
}
button:hover {
background: #218838;
}
.result, .error {
text-align: center;
margin-top: 20px;
font-size: 16px;
}
.error {
color: #c00;
}
.result {
color: #080;
}
#progressContainer {
margin-top: 20px;
text-align: center;
}
progress {
width: 100%;
height: 25px;
}
</style>
</head>
<body>
<div class="container">
<h1>Immich Selfie Timelapse Tool</h1>
{% if error %}
<p class="error">{{ error }}</p>
{% endif %}
<form method="post">
<label>
Person ID:
<input type="text" name="person_id" required>
</label>
<label>
Padding added around the face in percent:
<input type="number" step="1" name="padding_percent" value="{{ request.form.padding_percent or 30 }}">
</label>
<label>
Output image size:
<input type="number" name="resize_size" value="{{ request.form.resize_size or 512 }}">
</label>
<label>
Face resolution threshold:
<input type="number" name="face_resolution_threshold" value="{{ request.form.face_resolution_threshold or 128 }}">
</label>
<label>
Max orientation of the face (degrees):
<input type="number" step="0.1" name="pose_threshold" value="{{ request.form.pose_threshold or 25 }}">
</label>
<label>
Max Workers (CPU cores):
<select name="max_workers">
{% for i in max_workers_options %}
<option value="{{ i }}" {% if request.form.max_workers|default('1')|int == i %}selected{% endif %}>{{ i }}</option>
{% endfor %}
</select>
</label>
<button type="submit">Generate Timelapse</button>
</form>
{% if result %}
<p class="result">{{ result }}</p>
{% endif %}
<!-- Progress Bar -->
<div id="progressContainer">
<progress id="progressBar" value="0" max="100"></progress>
<p id="progressText">0%</p>
</div>
</div>
<script>
function fetchProgress() {
fetch('/progress')
.then(response => response.json())
.then(data => {
const progressBar = document.getElementById("progressBar");
const progressText = document.getElementById("progressText");
if (data.total > 0) {
progressBar.max = data.total;
progressBar.value = data.completed;
const percent = Math.floor((data.completed / data.total) * 100);
progressText.textContent = percent + "%";
}
})
.catch(err => console.error('Error fetching progress:', err));
}
// Poll every 1 second
setInterval(fetchProgress, 1000);
</script>
</body>
</html>