File size: 10,347 Bytes
093a2cd
 
 
 
2c143bb
093a2cd
2c143bb
093a2cd
2c143bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
093a2cd
 
 
2c143bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4c439af
aefb9c7
093a2cd
2c143bb
 
 
 
 
aefb9c7
 
093a2cd
2c143bb
 
 
 
 
 
 
 
 
 
 
093a2cd
2c143bb
 
 
 
 
 
 
 
 
093a2cd
2c143bb
 
 
 
 
 
093a2cd
2c143bb
 
 
 
 
093a2cd
2c143bb
093a2cd
2c143bb
 
 
093a2cd
2c143bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
093a2cd
2c143bb
 
 
 
 
 
 
093a2cd
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>EE Secure Client</title>
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
    <style>
        :root {
            --bg: #0d0f12;
            --surface: #161a20;
            --border: #252b34;
            --border-hover: #3a4452;
            --accent: #00d4aa;
            --accent-dim: rgba(0, 212, 170, 0.12);
            --text: #e2e8f0;
            --text-muted: #64748b;
            --text-dim: #94a3b8;
            --danger: #f87171;
            --danger-dim: rgba(248, 113, 113, 0.1);
            --mono: 'IBM Plex Mono', monospace;
            --sans: 'IBM Plex Sans', sans-serif;
        }

        * { box-sizing: border-box; margin: 0; padding: 0; }

        body {
            background: var(--bg);
            color: var(--text);
            font-family: var(--sans);
            min-height: 100vh;
            padding: 48px 24px;
        }

        .page {
            max-width: 620px;
            margin: 0 auto;
        }

        /* Header */
        .header {
            margin-bottom: 40px;
        }
        .header-badge {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            background: var(--accent-dim);
            border: 1px solid rgba(0,212,170,0.25);
            color: var(--accent);
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            padding: 5px 12px;
            border-radius: 4px;
            margin-bottom: 16px;
        }
        .lock-dot {
            width: 7px; height: 7px;
            background: var(--accent);
            border-radius: 50%;
            animation: blink 2.5s ease-in-out infinite;
        }
        @keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

        h1 {
            font-size: 26px;
            font-weight: 600;
            letter-spacing: -0.02em;
            color: var(--text);
            margin-bottom: 6px;
        }
        .subtitle {
            font-size: 14px;
            color: var(--text-muted);
            line-height: 1.5;
        }

        /* Card */
        .card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 28px;
            margin-bottom: 20px;
        }

        .section-label {
            font-family: var(--mono);
            font-size: 10px;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--text-muted);
            margin-bottom: 16px;
            padding-bottom: 10px;
            border-bottom: 1px solid var(--border);
        }

        /* Form */
        .field { margin-bottom: 20px; }
        .field:last-child { margin-bottom: 0; }

        label {
            display: block;
            font-size: 13px;
            font-weight: 500;
            color: var(--text-dim);
            margin-bottom: 7px;
        }
        label span {
            font-family: var(--mono);
            font-size: 11px;
            color: var(--text-muted);
            font-weight: 400;
        }

        input, textarea {
            width: 100%;
            background: var(--bg);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 10px 14px;
            color: var(--text);
            font-family: var(--sans);
            font-size: 14px;
            transition: border-color 0.15s;
            outline: none;
            -webkit-appearance: none;
        }
        input:focus, textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(0,212,170,0.08);
        }
        input::placeholder, textarea::placeholder {
            color: var(--text-muted);
        }
        textarea {
            resize: vertical;
            min-height: 120px;
            line-height: 1.6;
            font-family: var(--mono);
            font-size: 13px;
        }

        /* Inline row */
        .field-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }

        /* Submit */
        .btn {
            width: 100%;
            padding: 13px;
            background: var(--accent);
            color: #0d0f12;
            border: none;
            border-radius: 6px;
            font-family: var(--sans);
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            letter-spacing: 0.01em;
            transition: opacity 0.15s, transform 0.1s;
            margin-top: 4px;
        }
        .btn:hover { opacity: 0.88; }
        .btn:active { transform: scale(0.99); }
        .btn:disabled { opacity: 0.4; cursor: not-allowed; }

        /* Result */
        .result-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 10px;
            overflow: hidden;
        }
        .result-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 14px 20px;
            border-bottom: 1px solid var(--border);
            background: rgba(0,212,170,0.04);
        }
        .result-header-label {
            font-family: var(--mono);
            font-size: 11px;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--accent);
        }
        .result-body {
            padding: 20px;
            font-family: var(--mono);
            font-size: 13px;
            line-height: 1.7;
            color: var(--text);
            white-space: pre-wrap;
            word-break: break-word;
        }

        /* Error */
        .error-card {
            background: var(--danger-dim);
            border: 1px solid rgba(248,113,113,0.25);
            border-radius: 8px;
            padding: 14px 18px;
            font-size: 13px;
            color: var(--danger);
            font-family: var(--mono);
            line-height: 1.6;
            word-break: break-all;
        }
        .error-card::before {
            content: "ERROR β€” ";
            font-weight: 500;
        }

        /* Loading state */
        .btn.loading {
            position: relative;
            color: transparent;
        }
        .btn.loading::after {
            content: '';
            position: absolute;
            inset: 0;
            margin: auto;
            width: 18px; height: 18px;
            border: 2px solid rgba(13,15,18,0.3);
            border-top-color: #0d0f12;
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        .help-text {
            font-size: 12px;
            color: var(--text-muted);
            margin-top: 5px;
        }
    </style>
</head>
<body>
<div class="page">

    <div class="header">
        <div class="header-badge">
            <span class="lock-dot"></span>
            End-to-end encrypted
        </div>
        <h1>Equivariant Encryption Client</h1>
        <p class="subtitle">Prompts are encrypted locally before leaving this Space β€” the inference server only ever sees scrambled embeddings.</p>
    </div>

    <form method="POST" id="mainForm">

        <div class="card">
            <div class="section-label">Connection</div>

            <div class="field">
                <label>Server Space URL</label>
                <input type="url" name="server_url"
                    placeholder="https://your-ee-server.hf.space"
                    value="https://broadfield-dev-equivariant-encryption-server.hf.space"
                    required readonly>
            </div>

            <div class="field">
                <label>EE Model <span>β€” from Hugging Face Hub</span></label>
                <input type="text" name="ee_model_name"
                    placeholder="username/model-ee"
                    value="broadfield-dev/Qwen3-0.6B-dp-ee"
                    required readonly>
            </div>
        </div>

        <div class="card">
            <div class="section-label">Encryption Key</div>

            <div class="field">
                <label>Secret Seed <span>β€” never leaves this client</span></label>
                <input type="number" name="ee_seed"
                    value="{{ form.get('ee_seed', '424242') }}"
                    required>
                <p class="help-text">Use the same seed that was used when transforming the model.</p>
            </div>
        </div>

        <div class="card">
            <div class="section-label">Prompt</div>

            <div class="field">
                <label>Your message</label>
                <textarea name="prompt" required
                    placeholder="Enter your prompt here...">{{ form.get('prompt', '') }}</textarea>
            </div>

            <div class="field">
                <label>Max new tokens</label>
                <input type="number" name="max_tokens"
                    value="{{ form.get('max_tokens', '256') }}"
                    min="1" max="2048">
            </div>
        </div>

        <button type="submit" class="btn" id="submitBtn">
            Encrypt &amp; Send β†’
        </button>

    </form>

    {% if error %}
    <div style="margin-top:20px">
        <div class="error-card">{{ error }}</div>
    </div>
    {% endif %}

    {% if result %}
    <div style="margin-top:20px">
        <div class="result-card">
            <div class="result-header">
                <span class="result-header-label">Server response</span>
                <span style="font-size:12px; color: var(--text-muted); font-family: var(--mono);">decrypted locally</span>
            </div>
            <div class="result-body">{{ result }}</div>
        </div>
    </div>
    {% endif %}

</div>

<script>
    document.getElementById('mainForm').addEventListener('submit', function() {
        const btn = document.getElementById('submitBtn');
        btn.classList.add('loading');
        btn.disabled = true;
    });
</script>
</body>
</html>