HuggingJady commited on
Commit
3c753ad
·
verified ·
1 Parent(s): c17841a

Move the demo closer to a Claude-style layout

Browse files
Files changed (1) hide show
  1. app.py +49 -32
app.py CHANGED
@@ -192,10 +192,8 @@ def _turn_html(question, model_name, alpha, use_raw, base, steered):
192
  POSTER_HTML = """
193
  <section class="guide">
194
  <p class="guide-kicker">How to ask</p>
195
- <p>Type the concept you most want explained. Ask for a <b>literal</b> answer:
196
- accurate technical terminology, mechanisms, or a plain description.
197
- Do not say “analogy,” “imagine,” or “like.”</p>
198
- <p>The surprising part: the prompt stays literal, and the dial still makes the model reach for an analogy.</p>
199
  </section>
200
  <section class="turn poster-turn">
201
  <div class="poster-tag">On the poster · Gemma-2-27B-IT · layer 16 · not the live model</div>
@@ -244,26 +242,36 @@ def on_model_change(model_name):
244
 
245
 
246
  DIAL_CSS = """
 
247
  .gradio-container, .gradio-container * {
248
  font-family: "Source Sans 3", "Segoe UI", sans-serif !important;
249
  }
 
 
 
 
 
 
 
250
  .gradio-container, .gradio-container.dark, .dark {
251
  color-scheme: light !important;
252
  --body-background-fill: #faf9f5;
253
  --body-text-color: #141413;
254
  --body-text-color-subdued: #6b6560;
255
  --background-fill-primary: #faf9f5;
256
- --background-fill-secondary: #f7f6f2;
257
- --block-background-fill: #ffffff;
258
- --block-border-color: #e8e6dc;
259
  --block-label-text-color: #6b6560;
260
  --block-title-text-color: #141413;
261
  --input-background-fill: #ffffff;
262
  --input-border-color: #e8e6dc;
263
  --input-placeholder-color: #8a847c;
264
- --button-secondary-background-fill: #f0eee6;
265
  --button-secondary-text-color: #141413;
 
266
  --button-primary-text-color: #ffffff;
 
267
  --neutral-50: #faf9f5;
268
  --neutral-100: #f0eee6;
269
  --neutral-200: #e8e6dc;
@@ -277,31 +285,40 @@ textarea, input, select, .prose, .prose p, .prose span, label, .cmp-body, .cmp-b
277
  color: #141413 !important;
278
  }
279
  .guide-kicker, .cmp.steered .cmp-label { color: #c96442 !important; }
280
- textarea, input[type="text"], input[type="number"] { background: #ffffff !important; }
281
- button.primary, button.primary * { color: #ffffff !important; }
282
- #layout { flex-wrap: nowrap !important; align-items: flex-start !important; gap: 22px !important; }
 
 
 
 
 
 
 
 
 
 
283
  #chat-col { min-width: 0 !important; flex: 1 1 auto !important; }
284
- #dial-col { flex: 0 0 340px !important; width: 340px !important; position: sticky; top: 8px; }
285
- #chat-log { min-height: 62vh; max-height: 68vh; overflow-y: auto; padding-right: 4px; }
286
- #chat-log > .prose, #chat-log .html-container { max-height: 68vh; overflow-y: auto; }
287
- .guide { background: #f7f6f2; border: 1px solid #e8e6dc; border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
288
- .guide-kicker { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #c96442; margin: 0 0 6px; font-weight: 600; }
289
- .guide p { margin: 0 0 8px; line-height: 1.5; font-size: 16px; }
290
  .guide p:last-child { margin: 0; }
291
- .turn { margin: 0 0 18px; }
292
- .poster-tag { font-size: 13px; color: #6b6560; margin-bottom: 8px; }
293
- .user-row { display: flex; justify-content: flex-end; margin: 8px 0 10px; }
294
- .user-bubble { background: #f0eee6; color: #141413; border-radius: 18px; padding: 10px 14px; max-width: 86%; line-height: 1.45; font-size: 16px; }
295
- .asst-meta { font-size: 13px; color: #6b6560; margin: 0 0 8px; }
296
- .cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
297
- .cmp { border: 1px solid #e8e6dc; border-radius: 14px; padding: 10px 12px; background: #fff; min-width: 0; }
298
- .cmp.base { background: #f7f6f2; }
299
- .cmp.steered { background: #fbf6f2; border-color: #e7cbbd; }
300
- .cmp-label { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: #6b6560; margin-bottom: 6px; }
301
  .cmp.steered .cmp-label { color: #c96442; }
302
- .cmp-body { font-size: 15.5px; line-height: 1.55; color: #141413; }
303
- .poster-turn { border-top: 1px solid #e8e6dc; padding-top: 14px; }
304
- #dial-stack { position: relative; width: min(260px, 100%); margin: 0 auto; touch-action: none; user-select: none; }
305
  #dial { cursor: grab; touch-action: none; }
306
  #dial:active { cursor: grabbing; }
307
  #dial svg { width: 100%; height: auto; display: block; }
@@ -309,9 +326,9 @@ button.primary, button.primary * { color: #ffffff !important; }
309
  position: absolute; left: 0; right: 0; top: 62%;
310
  text-align: center; pointer-events: none;
311
  font-variant-numeric: tabular-nums;
312
- font-size: 1.35rem; font-weight: 650; letter-spacing: -0.03em; color: #141413;
313
  }
314
- #dial-ends { display: flex; justify-content: space-between; width: min(260px, 100%); margin: 0 auto 8px; color: #6b6560; font-size: 13px; }
315
  @media (max-width: 860px) {
316
  #layout { flex-wrap: wrap !important; }
317
  #dial-col { flex: 1 1 100% !important; width: 100% !important; position: static; }
 
192
  POSTER_HTML = """
193
  <section class="guide">
194
  <p class="guide-kicker">How to ask</p>
195
+ <p>Type the concept you most want explained, and ask for a literal answer. Accurate technical terminology is a good phrase. Do not say “analogy,” “imagine,” or “like.”</p>
196
+ <p>The prompt stays literal. The dial is what makes the model reach for an analogy.</p>
 
 
197
  </section>
198
  <section class="turn poster-turn">
199
  <div class="poster-tag">On the poster · Gemma-2-27B-IT · layer 16 · not the live model</div>
 
242
 
243
 
244
  DIAL_CSS = """
245
+ @import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600&family=Source+Serif+4:opsz,wght@8..60,480;8..60,560&display=swap');
246
  .gradio-container, .gradio-container * {
247
  font-family: "Source Sans 3", "Segoe UI", sans-serif !important;
248
  }
249
+ .gradio-container h1, .gradio-container h1 * {
250
+ font-family: "Source Serif 4", Georgia, serif !important;
251
+ font-weight: 480 !important;
252
+ letter-spacing: -0.03em !important;
253
+ font-size: 2.35rem !important;
254
+ line-height: 1.15 !important;
255
+ }
256
  .gradio-container, .gradio-container.dark, .dark {
257
  color-scheme: light !important;
258
  --body-background-fill: #faf9f5;
259
  --body-text-color: #141413;
260
  --body-text-color-subdued: #6b6560;
261
  --background-fill-primary: #faf9f5;
262
+ --background-fill-secondary: #faf9f5;
263
+ --block-background-fill: transparent;
264
+ --block-border-color: transparent;
265
  --block-label-text-color: #6b6560;
266
  --block-title-text-color: #141413;
267
  --input-background-fill: #ffffff;
268
  --input-border-color: #e8e6dc;
269
  --input-placeholder-color: #8a847c;
270
+ --button-secondary-background-fill: transparent;
271
  --button-secondary-text-color: #141413;
272
+ --button-secondary-border-color: #e8e6dc;
273
  --button-primary-text-color: #ffffff;
274
+ --border-color-primary: #e8e6dc;
275
  --neutral-50: #faf9f5;
276
  --neutral-100: #f0eee6;
277
  --neutral-200: #e8e6dc;
 
285
  color: #141413 !important;
286
  }
287
  .guide-kicker, .cmp.steered .cmp-label { color: #c96442 !important; }
288
+ textarea, input[type="text"], input[type="number"] {
289
+ background: #ffffff !important;
290
+ border: 1px solid #e8e6dc !important;
291
+ border-radius: 22px !important;
292
+ }
293
+ button { border-radius: 999px !important; box-shadow: none !important; }
294
+ button.primary, button.primary * { color: #ffffff !important; background: #c96442 !important; }
295
+ #dial-col .block, #dial-col fieldset, #chat-col .block {
296
+ border: none !important;
297
+ background: transparent !important;
298
+ box-shadow: none !important;
299
+ }
300
+ #layout { flex-wrap: nowrap !important; align-items: flex-start !important; gap: 36px !important; }
301
  #chat-col { min-width: 0 !important; flex: 1 1 auto !important; }
302
+ #dial-col { flex: 0 0 300px !important; width: 300px !important; position: sticky; top: 12px; }
303
+ #chat-log { min-height: 58vh; max-height: 64vh; overflow-y: auto; padding-right: 8px; }
304
+ .guide { background: transparent; border: none; padding: 0 0 4px; margin: 0 0 18px; }
305
+ .guide-kicker { font-family: "Source Sans 3", sans-serif !important; font-size: 13px; letter-spacing: 0.04em; text-transform: none; color: #c96442; margin: 0 0 6px; font-weight: 600; }
306
+ .guide p { margin: 0 0 8px; line-height: 1.55; font-size: 17px; }
 
307
  .guide p:last-child { margin: 0; }
308
+ .turn { margin: 8px 0 28px; }
309
+ .poster-tag { font-size: 13px; color: #6b6560; margin-bottom: 10px; }
310
+ .user-row { display: flex; justify-content: flex-end; margin: 10px 0 14px; }
311
+ .user-bubble { background: #f0eee6; color: #141413; border-radius: 22px; padding: 12px 16px; max-width: 80%; line-height: 1.5; font-size: 16.5px; }
312
+ .asst-meta { font-size: 13px; color: #6b6560; margin: 0 0 12px; }
313
+ .cmp-row { display: grid; grid-template-columns: 1fr 1.15fr; gap: 28px; }
314
+ .cmp { border: none; border-radius: 0; padding: 0; background: transparent; min-width: 0; }
315
+ .cmp.base .cmp-body { color: #6b6560 !important; }
316
+ .cmp.steered { border-left: 2px solid #e7cbbd; padding-left: 16px; }
317
+ .cmp-label { font-size: 13px; font-weight: 600; letter-spacing: 0; color: #6b6560; margin-bottom: 8px; }
318
  .cmp.steered .cmp-label { color: #c96442; }
319
+ .cmp-body { font-size: 16.5px; line-height: 1.6; color: #141413; }
320
+ .poster-turn { border-top: none; padding-top: 8px; }
321
+ #dial-stack { position: relative; width: min(240px, 100%); margin: 4px auto 0; touch-action: none; user-select: none; }
322
  #dial { cursor: grab; touch-action: none; }
323
  #dial:active { cursor: grabbing; }
324
  #dial svg { width: 100%; height: auto; display: block; }
 
326
  position: absolute; left: 0; right: 0; top: 62%;
327
  text-align: center; pointer-events: none;
328
  font-variant-numeric: tabular-nums;
329
+ font-size: 1.25rem; font-weight: 600; letter-spacing: -0.03em; color: #141413;
330
  }
331
+ #dial-ends { display: flex; justify-content: space-between; width: min(240px, 100%); margin: 0 auto 10px; color: #6b6560; font-size: 13px; }
332
  @media (max-width: 860px) {
333
  #layout { flex-wrap: wrap !important; }
334
  #dial-col { flex: 1 1 100% !important; width: 100% !important; position: static; }