Spaces:
Running
Running
File size: 15,017 Bytes
6d69a4c e8313c1 6d69a4c e8313c1 6d69a4c e8313c1 6d69a4c e8313c1 d34d52f e8313c1 a1aae1c e8313c1 6d69a4c e8313c1 6d69a4c 0cdcb6f 6d69a4c d34d52f 6d69a4c d34d52f 6d69a4c e8313c1 6d69a4c e8313c1 a1aae1c 6d69a4c d34d52f 6d69a4c e8313c1 6d69a4c d34d52f 6d69a4c e8313c1 d34d52f 6d69a4c d34d52f e8313c1 6d69a4c d34d52f 6d69a4c 0cdcb6f 6d69a4c d34d52f 6d69a4c e8313c1 6d69a4c d34d52f 6d69a4c d34d52f 6d69a4c 0cdcb6f 6d69a4c cb10dda a1aae1c cb10dda a1aae1c 6d69a4c cb10dda 6d69a4c aa387a3 6d69a4c efaac09 6d69a4c e8313c1 6d69a4c 0cdcb6f 6d69a4c |
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Private SynthID - Check if your text is AI Generated</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<style>
@import url('https://fonts.googleapis.com/css2?family=Telegraf:wght@400;500;600;700&display=swap');
:root {
--yellow: #ffd200;
--black: #000;
--white: #fff;
--grey-050: #f9f9f9;
--grey-200: #e0e0e0;
--container-max: 1200px;
--shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
--spacing-unit: 8px;
}
/* reset */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
body {
font-family: 'Telegraf', sans-serif;
background: var(--yellow);
color: var(--black);
line-height: 1.5;
font-weight: 400;
}
.explanation-text {
font-size: 1.3rem;
line-height: 1.6;
margin-bottom: calc(var(--spacing-unit) * 4);
}
.explanation-text a {
color: var(--black);
text-decoration: underline;
font-weight: 500;
}
.explanation-text a:hover {
opacity: 0.8;
}
/* navbar */
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 4);
max-width: var(--container-max);
margin-inline: auto;
}
.logo {
font-size: 2rem;
font-weight: 700;
letter-spacing: -0.02em;
}
.contact-btn {
border: 2px solid var(--black);
background: transparent;
color: var(--black);
padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
font-family: 'Telegraf', sans-serif;
cursor: pointer;
transition: all .2s ease;
text-decoration: none;
display: inline-block;
}
.contact-btn:hover {
background: var(--black);
color: var(--yellow);
transform: translateY(-1px);
}
/* hero */
.hero {
display: grid;
gap: calc(var(--spacing-unit) * 6);
align-items: center;
max-width: var(--container-max);
margin: calc(var(--spacing-unit) * 4) auto calc(var(--spacing-unit) * 10);
padding-inline: calc(var(--spacing-unit) * 4);
grid-template-columns: 1fr 1fr;
}
.hero h1 {
font-size: clamp(3rem, 6vw, 4.5rem);
font-weight: 700;
margin-bottom: calc(var(--spacing-unit) * 3);
letter-spacing: -0.03em;
line-height: 1.1;
}
.hero p {
font-size: 1.4rem;
max-width: 45ch;
font-weight: 400;
line-height: 1.5;
}
.hero-diagram {
background: var(--white);
border: 2px solid var(--black);
border-radius: 0;
padding: calc(var(--spacing-unit) * 4);
box-shadow: 8px 8px 0 var(--black);
width: 100%;
min-height: 400px;
display: flex;
align-items: center;
justify-content: center;
}
.hero-diagram .mermaid {
max-width: 100%;
font-family: 'Telegraf', sans-serif;
font-size: 1.2rem;
}
/* wizard */
main {
max-width: var(--container-max);
margin: 0 auto calc(var(--spacing-unit) * 12);
padding: 0 calc(var(--spacing-unit) * 4);
}
.section-title {
font-size: 3rem;
font-weight: 700;
margin-bottom: calc(var(--spacing-unit) * 6);
text-align: center;
letter-spacing: -0.02em;
}
.cards-wrapper {
display: grid;
gap: calc(var(--spacing-unit) * 3);
grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
}
.card {
background: var(--white);
border: 2px solid var(--black);
border-radius: 0;
box-shadow: 6px 6px 0 var(--black);
padding: calc(var(--spacing-unit) * 4);
min-height: 280px;
display: flex;
flex-direction: column;
transition: transform 0.2s ease;
}
.card:hover {
transform: translate(-2px, -2px);
box-shadow: 8px 8px 0 var(--black);
}
.card h2 {
margin-bottom: calc(var(--spacing-unit) * 3);
font-size: 1.8rem;
font-weight: 700;
letter-spacing: -0.01em;
height: 30px;
}
.card-content {
flex: 1;
display: flex;
flex-direction: column;
gap: calc(var(--spacing-unit) * 2);
}
.controls {
display: flex;
align-items: center;
gap: calc(var(--spacing-unit) * 1.5);
min-height: 40px;
}
textarea {
width: 100%;
padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2);
border: 2px solid var(--black);
border-radius: 0;
font-family: 'Telegraf', sans-serif;
font-size: 1.2rem;
resize: vertical;
background: var(--white);
min-height: 60px;
transition: all 0.2s ease;
font-weight: 500;
}
textarea:focus {
outline: none;
transform: translate(-2px, -2px);
box-shadow: 4px 4px 0 var(--black);
}
.btn {
border: 2px solid var(--black);
background: var(--yellow);
color: var(--black);
font-weight: 600;
padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
min-width: 160px;
font-size: 1.2rem;
font-family: 'Telegraf', sans-serif;
border-radius: 0;
cursor: pointer;
transition: all .2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
gap: calc(var(--spacing-unit) * 1);
white-space: nowrap;
letter-spacing: -0.01em;
}
.btn:hover:not(:disabled) {
background: var(--black);
color: var(--yellow);
transform: translateY(-2px);
}
.btn:disabled {
opacity: .5;
cursor: not-allowed;
}
.status {
font-size: 1.2rem;
color: var(--black);
flex: 1;
font-weight: 500;
}
.loader {
width: 20px;
height: 20px;
border: 3px solid transparent;
border-top: 3px solid var(--black);
border-right: 3px solid var(--black);
border-radius: 50%;
animation: spin 1s linear infinite;
flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg);} }
#encIcon {
font-size: 1.25rem;
flex-shrink: 0;
}
footer {
font-size: 1.2rem;
text-align: center;
padding: calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 2);
color: var(--black);
font-weight: 500;
}
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
/* Result styling */
#decResult {
font-family: 'Telegraf', sans-serif;
padding: calc(var(--spacing-unit) * 2);
background: var(--grey-050);
border: 2px solid var(--black);
border-radius: 8px;
min-height: 48px;
display: flex;
align-items: center;
font-weight: 600;
font-size: 1.3rem;
}
#decResult:not(:empty) {
color: var(--black);
}
/* Responsive adjustments */
@media (max-width: 968px) {
.hero {
grid-template-columns: 1fr;
gap: calc(var(--spacing-unit) * 4);
}
.hero-diagram {
min-height: 300px;
}
}
@media (max-width: 768px) {
.cards-wrapper {
gap: calc(var(--spacing-unit) * 2);
}
.card {
padding: calc(var(--spacing-unit) * 3);
box-shadow: 4px 4px 0 var(--black);
}
.btn {
min-width: 140px;
padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 2.5);
}
.hero h1 {
font-size: 2.5rem;
}
.section-title {
font-size: 2rem;
}
}
</style>
<!-- external scripts -->
<script type="module" src="https://belladoreai.github.io/llama3-tokenizer-js/bundle/llama3-tokenizer-with-baked-data.js"></script>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/[email protected]/+esm';
mermaid.initialize({
startOnLoad: true,
theme: 'base',
themeVariables: {
primaryColor: '#ffd200',
primaryTextColor: '#000',
lineColor: '#000',
tertiaryColor: '#fff',
fontFamily: 'Telegraf',
fontSize: '1.4rem'
},
flowchart: {
nodeSpacing: 50,
rankSpacing: 50,
curve: 'basis',
fontSize: '1.4rem'
},
sequence: {
actorFontSize: '1.4rem',
noteFontSize: '1.4rem',
messageFontSize: '1.4rem'
}
});
</script>
</head>
<body>
<!-- Navbar -->
<nav class="navbar">
<div class="logo">ZAMA</div>
<a href="https://www.zama.ai/contact" class="contact-btn" target="_blank" rel="noopener noreferrer">Contact us</a>
</nav>
<!-- Hero -->
<header class="hero" role="banner">
<div class="hero-copy">
<h1>Private Watermark Detection - Check if your text contains watermarks</h1>
<div class="explanation-text">
Private SynthID uses Google's SynthID technology to detect watermarks in AI-generated text while preserving privacy through Fully Homomorphic Encryption (FHE). This means you can check if text contains AI watermarks without revealing the content to anyone. Note that this only detects watermarked text - not all AI-generated text will be detected. Learn more about <a href="https://deepmind.google/science/synthid/" target="_blank">SynthID</a> and <a href="https://www.zama.ai/" target="_blank">FHE applications</a>.
</div>
</div>
<div class="hero-diagram">
<pre class="mermaid">
sequenceDiagram
participant User🧑💻
participant Browser🔐
participant RustServer🦀
User🧑💻->>Browser🔐: 1️⃣ Generate keys
Browser🔐->>Browser🔐: TFHE keygen (WASM)
Browser🔐->>RustServer🦀: 2️⃣ /handshake (server_key_b64)
RustServer🦀->>Browser🔐: UID (uuid-v4)
User🧑💻->>Browser🔐: 3️⃣ Enter text
Browser🔐->>Browser🔐: Tokenise ◁ HF tokenizer
Browser🔐->>Browser🔐: Encrypt tokens (WASM)
Browser🔐->>RustServer🦀: 4️⃣ /detect (uid, ciphertext_b64)
RustServer🦀->>RustServer🦀: FHE SynthID detect
RustServer🦀->>Browser🔐: Encrypted result_b64
Browser🔐->>Browser🔐: Decrypt result (WASM)
Browser🔐-->>User🧑💻: flag / score / g
</pre>
</div>
</header>
<!-- Wizard Steps -->
<main>
<h2 class="section-title">How watermark detection works</h2>
<div class="cards-wrapper">
<!-- 1 Keys -->
<section class="card" aria-labelledby="step1">
<h2 id="step1">1. Keys</h2>
<div class="card-content">
<div class="controls" style="margin-top: 0;">
<p id="keygenStatus" class="status" aria-live="polite">Ready to generate keys</p>
<span id="keygenSpin" class="loader" hidden aria-label="Generating keys"></span>
</div>
<div style="display:flex; gap:var(--spacing-unit); margin-top:auto">
<button id="btnKeygen" class="btn" aria-describedby="keygenStatus">🔑 Generate keys</button>
<button id="btnLoadSaved" class="btn" aria-describedby="keygenStatus">🗝️ Load keys</button>
</div>
</div>
</section>
<!-- 2 Encrypt -->
<section class="card" aria-labelledby="step2">
<h2 id="step2">2. Encrypt text</h2>
<div class="card-content">
<div class="controls">
<p id="tokenizerStatus" class="status" aria-live="polite" style="display: none;">Loading tokenizer...</p>
<span id="tokenizerSpin" class="loader" hidden aria-label="Loading tokenizer"></span>
</div>
<label for="tokenInput" class="visually-hidden">Text to encrypt</label>
<textarea id="tokenInput" rows="2" placeholder="Enter text to encrypt" autocomplete="off"></textarea>
<div style="display: flex; gap: calc(var(--spacing-unit) * 1); margin-bottom: calc(var(--spacing-unit) * 2); flex-wrap: wrap;">
<button id="btnWatermarked" class="btn" style="min-width: auto; padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 1.5); font-size: 1rem;">✅ Watermarked</button>
<button id="btnNotWatermarked" class="btn" style="min-width: auto; padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 1.5); font-size: 1rem;">❌ Not watermarked</button>
</div>
<div class="controls" style="margin-top: auto;">
<button id="btnEncrypt" class="btn" disabled>🛡️ Encrypt</button>
<span id="encryptSpin" class="loader" hidden aria-label="Encrypting"></span>
<span id="encIcon" hidden aria-label="Encrypted">🔒</span>
<span id="encStatus" class="status"></span>
</div>
</div>
</section>
<!-- 3 Send -->
<section class="card" aria-labelledby="step3">
<h2 id="step3">3. Send to server</h2>
<div class="card-content">
<div>
<p id="srvStatus" class="status" aria-live="polite">Waiting for encrypted data...</p>
<p id="srvComputing" class="status" aria-live="polite" hidden>Server computing...</p>
</div>
<div class="controls" style="margin-top: auto;">
<button id="btnSend" class="btn" disabled>📡 Send</button>
<span id="spin" class="loader" hidden aria-label="Working"></span>
</div>
</div>
</section>
<!-- 4 Result -->
<section class="card" aria-labelledby="step4">
<h2 id="step4">4. Result</h2>
<div class="card-content">
<label for="encResult" class="visually-hidden">Encrypted result bytes</label>
<textarea id="encResult" rows="1" readonly placeholder="Encrypted result will appear here"></textarea>
<p id="decResult" aria-live="polite" style="flex: 1;"></p>
<div class="controls" style="margin-top: auto;">
<button id="btnDecrypt" class="btn" disabled>🔓 Decrypt</button>
</div>
</div>
</section>
</div>
</main>
<footer>© 2025 Zama — Demo only, not for production use.</footer>
<script type="module" src="wasm-demo.js"></script>
<script>
// Since the tokenizer loads automatically and there's no explicit loading status in the JS,
// we'll hide the tokenizer status message on page load
window.addEventListener('DOMContentLoaded', () => {
const tokenizerStatus = document.getElementById('tokenizerStatus');
if (tokenizerStatus) {
tokenizerStatus.style.display = 'none';
}
});
</script>
</body>
</html> |