7f08813635
Matches the German search words shown on the demo slide in the presentation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
233 lines
6.6 KiB
HTML
233 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Vector Image Search — Oracle 26ai</title>
|
|
<style>
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { font-family: system-ui, sans-serif; background: #f5f5f5; color: #222; }
|
|
|
|
header {
|
|
background: #c74634;
|
|
color: white;
|
|
padding: 1.2rem 2rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
header h1 { font-size: 1.4rem; font-weight: 600; }
|
|
.badge {
|
|
background: white;
|
|
color: #c74634;
|
|
font-size: 0.75rem;
|
|
font-weight: 700;
|
|
padding: 0.2rem 0.6rem;
|
|
border-radius: 999px;
|
|
}
|
|
|
|
.search-area {
|
|
max-width: 700px;
|
|
margin: 2rem auto 1rem;
|
|
padding: 0 1rem;
|
|
}
|
|
.search-row {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
}
|
|
input[type="text"] {
|
|
flex: 1;
|
|
padding: 0.7rem 1rem;
|
|
font-size: 1rem;
|
|
border: 1px solid #ccc;
|
|
border-radius: 6px;
|
|
}
|
|
button.search-btn {
|
|
padding: 0.7rem 1.4rem;
|
|
background: #c74634;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 6px;
|
|
font-size: 1rem;
|
|
cursor: pointer;
|
|
}
|
|
button.search-btn:hover { background: #a83929; }
|
|
|
|
.chips {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.4rem;
|
|
margin-top: 0.8rem;
|
|
}
|
|
.chip {
|
|
padding: 0.3rem 0.8rem;
|
|
background: white;
|
|
border: 1px solid #ccc;
|
|
border-radius: 999px;
|
|
font-size: 0.85rem;
|
|
cursor: pointer;
|
|
}
|
|
.chip:hover { background: #fcecea; border-color: #c74634; }
|
|
|
|
.stats { text-align: center; color: #666; font-size: 0.85rem; margin-bottom: 1rem; }
|
|
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
|
gap: 1rem;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 0 1rem 2rem;
|
|
}
|
|
.card {
|
|
background: white;
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
box-shadow: 0 1px 4px rgba(0,0,0,0.1);
|
|
}
|
|
.card img {
|
|
width: 100%;
|
|
height: 140px;
|
|
object-fit: cover;
|
|
display: block;
|
|
}
|
|
.card-info {
|
|
padding: 0.5rem 0.7rem;
|
|
font-size: 0.8rem;
|
|
}
|
|
.card-info .score {
|
|
font-weight: 700;
|
|
color: #c74634;
|
|
}
|
|
.card-info .name {
|
|
color: #555;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
.empty { text-align: center; color: #999; margin-top: 3rem; font-size: 1rem; }
|
|
|
|
.card img { cursor: pointer; }
|
|
.card img:hover { opacity: 0.85; }
|
|
|
|
.lightbox {
|
|
display: none;
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0,0,0,0.85);
|
|
z-index: 100;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
gap: 0.8rem;
|
|
}
|
|
.lightbox.open { display: flex; }
|
|
.lightbox img {
|
|
max-width: 90vw;
|
|
max-height: 80vh;
|
|
object-fit: contain;
|
|
border-radius: 4px;
|
|
box-shadow: 0 4px 32px rgba(0,0,0,0.6);
|
|
}
|
|
.lightbox-info { color: white; font-size: 0.95rem; text-align: center; }
|
|
.lightbox-info .lb-score { color: #f38ba8; font-weight: 700; }
|
|
.lightbox-close {
|
|
position: fixed;
|
|
top: 1rem; right: 1.2rem;
|
|
color: white; font-size: 2rem;
|
|
cursor: pointer; line-height: 1;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>Vector Image Search</h1>
|
|
<span class="badge">Oracle 26ai</span>
|
|
</header>
|
|
|
|
<div class="search-area">
|
|
<div class="search-row">
|
|
<input id="query" type="text" placeholder="Fotos suchen, z.B. Bäume, Wasser, Nacht…" />
|
|
<button class="search-btn" onclick="doSearch()">Search</button>
|
|
</div>
|
|
<div class="chips">
|
|
<span class="chip" onclick="setQuery('Bäume')">Bäume</span>
|
|
<span class="chip" onclick="setQuery('Wasser')">Wasser</span>
|
|
<span class="chip" onclick="setQuery('Menschen')">Menschen</span>
|
|
<span class="chip" onclick="setQuery('Gebäude')">Gebäude</span>
|
|
<span class="chip" onclick="setQuery('Himmel')">Himmel</span>
|
|
<span class="chip" onclick="setQuery('Straße')">Straße</span>
|
|
<span class="chip" onclick="setQuery('Nacht')">Nacht</span>
|
|
<span class="chip" onclick="setQuery('Autos')">Autos</span>
|
|
</div>
|
|
</div>
|
|
|
|
<p class="stats" id="stats"></p>
|
|
<div class="grid" id="grid"><p class="empty">Enter a search term above.</p></div>
|
|
|
|
<div class="lightbox" id="lightbox" onclick="closeLightbox()">
|
|
<span class="lightbox-close" onclick="closeLightbox()">✕</span>
|
|
<img id="lb-img" src="" alt="" />
|
|
<div class="lightbox-info">
|
|
<span id="lb-name"></span> · <span class="lb-score" id="lb-score"></span>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const API = "http://localhost:8001";
|
|
|
|
fetch(`${API}/stats`)
|
|
.then(r => r.json())
|
|
.then(d => document.getElementById("stats").textContent = `${d.count} photos indexed`);
|
|
|
|
document.getElementById("query").addEventListener("keydown", e => {
|
|
if (e.key === "Enter") doSearch();
|
|
});
|
|
|
|
function setQuery(text) {
|
|
document.getElementById("query").value = text;
|
|
doSearch();
|
|
}
|
|
|
|
function doSearch() {
|
|
const q = document.getElementById("query").value.trim();
|
|
if (!q) return;
|
|
fetch(`${API}/search?q=${encodeURIComponent(q)}&limit=12`)
|
|
.then(r => r.json())
|
|
.then(renderResults);
|
|
}
|
|
|
|
function renderResults(results) {
|
|
const grid = document.getElementById("grid");
|
|
if (!results.length) {
|
|
grid.innerHTML = '<p class="empty">No results found.</p>';
|
|
return;
|
|
}
|
|
grid.innerHTML = results.map(r => `
|
|
<div class="card">
|
|
<img src="${API}/photos/${encodeURIComponent(r.filename)}" alt="${r.filename}" loading="lazy"
|
|
onclick="openLightbox('${encodeURIComponent(r.filename)}','${r.filename}','${(r.score*100).toFixed(1)}%')" />
|
|
<div class="card-info">
|
|
<div class="score">${(r.score * 100).toFixed(1)}% match</div>
|
|
<div class="name">${r.filename}</div>
|
|
</div>
|
|
</div>
|
|
`).join("");
|
|
}
|
|
|
|
function openLightbox(encoded, name, score) {
|
|
document.getElementById("lb-img").src = `${API}/photos/${encoded}`;
|
|
document.getElementById("lb-name").textContent = name;
|
|
document.getElementById("lb-score").textContent = score + " match";
|
|
document.getElementById("lightbox").classList.add("open");
|
|
}
|
|
|
|
function closeLightbox() {
|
|
document.getElementById("lightbox").classList.remove("open");
|
|
}
|
|
|
|
document.addEventListener("keydown", e => { if (e.key === "Escape") closeLightbox(); });
|
|
</script>
|
|
</body>
|
|
</html>
|