jejunepixels commited on
Commit
e55bfe8
·
verified ·
1 Parent(s): 3ce4754

Move reset to a compact corner icon and show model above stream

Browse files
Files changed (2) hide show
  1. app.py +8 -4
  2. style.css +49 -38
app.py CHANGED
@@ -262,14 +262,16 @@ def build_app():
262
  "Without a written prompt, output can be prose, code, lists, or other training-data patterns.")
263
  with gr.Column(visible=False, elem_id="flow-workspace") as workspace:
264
  gr.HTML(SCENE, elem_id="space-scene")
265
- page = gr.Textbox(label="The stream", lines=5, max_lines=8,
266
- placeholder="No written prompt. Just the next token.", show_label=False,
267
- interactive=False, show_copy_button=True, elem_id="page")
 
 
 
268
  with gr.Column(elem_id="control-dock"):
269
  with gr.Row(elem_id="stream-buttons"):
270
  gr.HTML('<button type="button" class="generation-toggle-button" data-generation-toggle>Start</button>',
271
  elem_id="generation-toggle")
272
- reset_model = gr.Button("Reset", elem_id="reset-model")
273
  with gr.Accordion("Settings, model & attention", open=False, elem_id="settings-drawer"):
274
  if ZERO_GPU:
275
  gr.LoginButton()
@@ -324,6 +326,8 @@ def build_app():
324
  (attention_head, "attention_head")]:
325
  component.input(control_handler(name), [component, flow], [], queue=False,
326
  trigger_mode="always_last", api_name=f"update_{name}", show_progress="hidden")
 
 
327
  load.click(load_model, [repo, flow], [model_status, *outputs, seed, picker, workspace], **common)
328
  reset_model.click(choose_model, [flow], [picker, workspace], queue=False).then(
329
  reset_view, [flow], outputs, api_name="reset_model_state", **common)
 
262
  "Without a written prompt, output can be prose, code, lists, or other training-data patterns.")
263
  with gr.Column(visible=False, elem_id="flow-workspace") as workspace:
264
  gr.HTML(SCENE, elem_id="space-scene")
265
+ with gr.Column(elem_id="text-overlay"):
266
+ model_badge = gr.HTML('', elem_id="model-name")
267
+ page = gr.Textbox(label="The stream", lines=5, max_lines=8,
268
+ placeholder="No written prompt. Just the next token.", show_label=False,
269
+ interactive=False, show_copy_button=True, elem_id="page")
270
+ reset_model = gr.Button("Reset", elem_id="reset-model", size="sm", min_width=0)
271
  with gr.Column(elem_id="control-dock"):
272
  with gr.Row(elem_id="stream-buttons"):
273
  gr.HTML('<button type="button" class="generation-toggle-button" data-generation-toggle>Start</button>',
274
  elem_id="generation-toggle")
 
275
  with gr.Accordion("Settings, model & attention", open=False, elem_id="settings-drawer"):
276
  if ZERO_GPU:
277
  gr.LoginButton()
 
326
  (attention_head, "attention_head")]:
327
  component.input(control_handler(name), [component, flow], [], queue=False,
328
  trigger_mode="always_last", api_name=f"update_{name}", show_progress="hidden")
329
+ model_status.change(lambda description: '<span>' + html.escape(description.split(' \u00b7', 1)[0]) + '</span>',
330
+ [model_status], model_badge, queue=False, api_name=False)
331
  load.click(load_model, [repo, flow], [model_status, *outputs, seed, picker, workspace], **common)
332
  reset_model.click(choose_model, [flow], [picker, workspace], queue=False).then(
333
  reset_view, [flow], outputs, api_name="reset_model_state", **common)
style.css CHANGED
@@ -32,47 +32,58 @@ header p { font: 18px/1.6 Georgia, serif; color: #777; }
32
  .space-empty small { font:13px/1.5 system-ui,sans-serif; opacity:.65; }
33
  .space-transport { display:none !important; }
34
  @media(max-width:640px) { .space-bottom { font-size:9px;left:12px;right:12px; } .space-top { left:12px;right:12px;font-size:9px; } #model-picker { margin:3vh auto; } }
35
- .space-tools { position:absolute; top:48px; left:22px; right:22px; display:flex; align-items:center; gap:14px; flex-wrap:wrap; font:12px/1.4 system-ui,sans-serif; }
36
- .space-tools label { display:flex; align-items:center; gap:7px; color:#c2dadc; }
37
- .space-tools select,.space-tools button { border:1px solid #577f89; border-radius:7px; padding:6px 8px; background:#112530; color:#d6e9e9; cursor:pointer; font:inherit; }
38
- .space-detail { position:absolute; left:22px; bottom:44px; max-width:min(650px,85%); padding:8px 12px; border-radius:7px; background:#0a1726d9; color:#c4d8da; font:11px/1.5 system-ui,sans-serif; pointer-events:none; }
39
  @media(max-width:640px){ .space-tools{top:43px;left:12px;right:12px;gap:7px;font-size:10px;} .space-detail{left:12px;bottom:55px;font-size:10px;} .space-bottom{flex-wrap:wrap;} }
40
- /* Loaded experience: a viewport-sized canvas with text and controls above it. */
41
- .gradio-container { max-width:none !important; min-height:100dvh !important; }
42
- #flow-workspace { position:fixed !important; inset:0 !important; width:100vw !important; height:100dvh !important; margin:0 !important; padding:0 !important; gap:0 !important; overflow:hidden !important; background:#080f18; z-index:50; }
43
- #space-scene { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; z-index:0; }
44
- #token-universe { width:100%; height:100% !important; border-radius:0 !important; }
45
- #page { position:absolute !important; top:max(18px,env(safe-area-inset-top)); left:clamp(16px,4vw,72px); right:clamp(16px,4vw,72px); width:auto !important; z-index:2; padding:0 !important; border:1px solid #b4dad52b !important; border-radius:16px !important; background:linear-gradient(180deg,#091622ed,#091622b0) !important; backdrop-filter:blur(10px); box-shadow:0 10px 40px #0003; }
46
- #page textarea { height:clamp(110px,22vh,240px) !important; min-height:110px !important; max-height:45vh !important; overflow-y:auto !important; resize:vertical !important; color:#e0eeeb !important; background:transparent !important; border:none !important; font:clamp(16px,1.5vw,21px)/1.7 Georgia,serif !important; padding:20px 24px !important; scrollbar-color:#668c8b #10232d; }
47
- #page > div { background:transparent !important; }
48
- #control-dock { position:absolute !important; bottom:max(16px,env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(940px,calc(100vw - 32px)) !important; max-height:65dvh; overflow-y:auto; z-index:4; padding:12px !important; border:1px solid #6d9f9b66; border-radius:18px; background:#eaf2eff2; backdrop-filter:blur(18px); box-shadow:0 12px 50px #0006; gap:8px !important; }
49
- #stream-buttons { gap:10px !important; flex-wrap:nowrap !important; }
50
- #stream-buttons button { min-height:44px; min-width:0 !important; }
51
- #settings-drawer { border:0 !important; background:transparent !important; }
52
- #sampling-controls { flex-wrap:wrap; }
53
- #sampling-controls > div { min-width:180px !important; }
54
- .space-top { top:auto !important; bottom:8px; left:18px; right:18px; font-size:9px; opacity:.5; }
55
- .space-tools { top:auto !important; bottom:150px; left:24px; right:24px; justify-content:center; gap:10px; z-index:1; }
56
- .space-detail { bottom:203px; left:24px; max-width:min(720px,calc(100vw - 48px)); z-index:1; }
57
- .space-bottom { display:none !important; }
58
  @media(max-width:640px) { #page { left:12px;right:12px;top:12px; } #page textarea { height:20vh !important; font-size:16px !important; padding:12px 16px !important; } #control-dock { bottom:12px;width:calc(100vw - 24px) !important;padding:8px !important;max-height:60dvh; } .space-tools { bottom:145px;left:12px;right:12px;font-size:10px;gap:6px; } .space-detail { bottom:228px;left:12px;max-width:calc(100vw - 24px);font-size:10px; } }
59
- #token-universe { position:fixed !important; inset:0 !important; width:100vw !important; height:100dvh !important; }
60
  #stream-buttons { position:sticky; top:0; z-index:6; background:#eaf2eff2; }
61
  #control-dock { --body-text-color:#203c3a; --body-text-color-subdued:#526b68; --input-text-color:#1c3536; --input-background-fill:#fff; --block-background-fill:#f4f8f6; --block-label-text-color:#29433f; --block-info-text-color:#526b68; color:#203c3a; }
62
- #page[data-token-inspection="true"] textarea { display:none !important; }
63
- .paused-token-reader { position:relative; height:clamp(110px,22vh,240px); max-height:45vh; overflow-y:auto; padding:14px 24px 20px; color:#e0eeeb; font:clamp(16px,1.5vw,21px)/1.7 Georgia,serif; scrollbar-color:#668c8b #10232d; }
64
- .token-reader-hint { position:sticky; top:-14px; padding:6px 0 10px; background:#0c1c27f5; color:#93c9be; font:11px/1.4 system-ui,sans-serif; letter-spacing:.04em; z-index:1; }
65
- .paused-token-content { white-space:pre-wrap; overflow-wrap:anywhere; }
66
- .paused-token-reader button.text-token { all:unset; display:inline; white-space:pre-wrap; font:inherit; color:inherit; cursor:pointer; border-radius:4px; }
67
- .paused-token-reader button.text-token:hover { background:#ffffff20; box-shadow:0 0 0 1px #8fd7c466; }
68
- .paused-token-reader button.text-token.is-selected { background:#eabe73; color:#17242b; box-shadow:0 0 0 2px #eabe7355; }
69
- .paused-token-reader button.text-token:focus-visible { outline:2px solid #9ce4d2; outline-offset:2px; }
70
- .token-piece-choices { margin-top:8px; color:#b4cdd2; font:12px/1.7 ui-monospace,monospace; }
71
  @media(max-width:640px){.paused-token-reader { height:20vh;padding:12px 16px;font-size:16px; }}
72
- .generation-proxy { display:none !important; }
73
- #generation-toggle { border:0 !important; padding:0 !important; background:transparent !important; flex:3 !important; min-width:0 !important; }
74
- #reset-model { flex:1 !important; min-width:80px !important; }
75
- .generation-toggle-button { width:100%; min-height:44px; padding:10px 18px; border:0; border-radius:10px; background:#20c7b6; color:#fff; font:600 16px/1.4 system-ui,sans-serif; cursor:pointer; box-shadow:0 2px 8px #173c381a; }
76
- .generation-toggle-button:hover { background:#16b5a5; }
77
- .generation-toggle-button:disabled { opacity:.65; cursor:wait; }
78
  .generation-toggle-button:focus-visible { outline:3px solid #547bba; outline-offset:2px; }
 
 
 
 
 
 
 
 
 
 
 
 
32
  .space-empty small { font:13px/1.5 system-ui,sans-serif; opacity:.65; }
33
  .space-transport { display:none !important; }
34
  @media(max-width:640px) { .space-bottom { font-size:9px;left:12px;right:12px; } .space-top { left:12px;right:12px;font-size:9px; } #model-picker { margin:3vh auto; } }
35
+ .space-tools { position:absolute; top:48px; left:22px; right:22px; display:flex; align-items:center; gap:14px; flex-wrap:wrap; font:12px/1.4 system-ui,sans-serif; }
36
+ .space-tools label { display:flex; align-items:center; gap:7px; color:#c2dadc; }
37
+ .space-tools select,.space-tools button { border:1px solid #577f89; border-radius:7px; padding:6px 8px; background:#112530; color:#d6e9e9; cursor:pointer; font:inherit; }
38
+ .space-detail { position:absolute; left:22px; bottom:44px; max-width:min(650px,85%); padding:8px 12px; border-radius:7px; background:#0a1726d9; color:#c4d8da; font:11px/1.5 system-ui,sans-serif; pointer-events:none; }
39
  @media(max-width:640px){ .space-tools{top:43px;left:12px;right:12px;gap:7px;font-size:10px;} .space-detail{left:12px;bottom:55px;font-size:10px;} .space-bottom{flex-wrap:wrap;} }
40
+ /* Loaded experience: a viewport-sized canvas with text and controls above it. */
41
+ .gradio-container { max-width:none !important; min-height:100dvh !important; }
42
+ #flow-workspace { position:fixed !important; inset:0 !important; width:100vw !important; height:100dvh !important; margin:0 !important; padding:0 !important; gap:0 !important; overflow:hidden !important; background:#080f18; z-index:50; }
43
+ #space-scene { position:absolute !important; inset:0 !important; width:100% !important; height:100% !important; z-index:0; }
44
+ #token-universe { width:100%; height:100% !important; border-radius:0 !important; }
45
+ #page { position:absolute !important; top:max(18px,env(safe-area-inset-top)); left:clamp(16px,4vw,72px); right:clamp(16px,4vw,72px); width:auto !important; z-index:2; padding:0 !important; border:1px solid #b4dad52b !important; border-radius:16px !important; background:linear-gradient(180deg,#091622ed,#091622b0) !important; backdrop-filter:blur(10px); box-shadow:0 10px 40px #0003; }
46
+ #page textarea { height:clamp(110px,22vh,240px) !important; min-height:110px !important; max-height:45vh !important; overflow-y:auto !important; resize:vertical !important; color:#e0eeeb !important; background:transparent !important; border:none !important; font:clamp(16px,1.5vw,21px)/1.7 Georgia,serif !important; padding:20px 24px !important; scrollbar-color:#668c8b #10232d; }
47
+ #page > div { background:transparent !important; }
48
+ #control-dock { position:absolute !important; bottom:max(16px,env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); width:min(940px,calc(100vw - 32px)) !important; max-height:65dvh; overflow-y:auto; z-index:4; padding:12px !important; border:1px solid #6d9f9b66; border-radius:18px; background:#eaf2eff2; backdrop-filter:blur(18px); box-shadow:0 12px 50px #0006; gap:8px !important; }
49
+ #stream-buttons { gap:10px !important; flex-wrap:nowrap !important; }
50
+ #stream-buttons button { min-height:44px; min-width:0 !important; }
51
+ #settings-drawer { border:0 !important; background:transparent !important; }
52
+ #sampling-controls { flex-wrap:wrap; }
53
+ #sampling-controls > div { min-width:180px !important; }
54
+ .space-top { top:auto !important; bottom:8px; left:18px; right:18px; font-size:9px; opacity:.5; }
55
+ .space-tools { top:auto !important; bottom:150px; left:24px; right:24px; justify-content:center; gap:10px; z-index:1; }
56
+ .space-detail { bottom:203px; left:24px; max-width:min(720px,calc(100vw - 48px)); z-index:1; }
57
+ .space-bottom { display:none !important; }
58
  @media(max-width:640px) { #page { left:12px;right:12px;top:12px; } #page textarea { height:20vh !important; font-size:16px !important; padding:12px 16px !important; } #control-dock { bottom:12px;width:calc(100vw - 24px) !important;padding:8px !important;max-height:60dvh; } .space-tools { bottom:145px;left:12px;right:12px;font-size:10px;gap:6px; } .space-detail { bottom:228px;left:12px;max-width:calc(100vw - 24px);font-size:10px; } }
59
+ #token-universe { position:fixed !important; inset:0 !important; width:100vw !important; height:100dvh !important; }
60
  #stream-buttons { position:sticky; top:0; z-index:6; background:#eaf2eff2; }
61
  #control-dock { --body-text-color:#203c3a; --body-text-color-subdued:#526b68; --input-text-color:#1c3536; --input-background-fill:#fff; --block-background-fill:#f4f8f6; --block-label-text-color:#29433f; --block-info-text-color:#526b68; color:#203c3a; }
62
+ #page[data-token-inspection="true"] textarea { display:none !important; }
63
+ .paused-token-reader { position:relative; height:clamp(110px,22vh,240px); max-height:45vh; overflow-y:auto; padding:14px 24px 20px; color:#e0eeeb; font:clamp(16px,1.5vw,21px)/1.7 Georgia,serif; scrollbar-color:#668c8b #10232d; }
64
+ .token-reader-hint { position:sticky; top:-14px; padding:6px 0 10px; background:#0c1c27f5; color:#93c9be; font:11px/1.4 system-ui,sans-serif; letter-spacing:.04em; z-index:1; }
65
+ .paused-token-content { white-space:pre-wrap; overflow-wrap:anywhere; }
66
+ .paused-token-reader button.text-token { all:unset; display:inline; white-space:pre-wrap; font:inherit; color:inherit; cursor:pointer; border-radius:4px; }
67
+ .paused-token-reader button.text-token:hover { background:#ffffff20; box-shadow:0 0 0 1px #8fd7c466; }
68
+ .paused-token-reader button.text-token.is-selected { background:#eabe73; color:#17242b; box-shadow:0 0 0 2px #eabe7355; }
69
+ .paused-token-reader button.text-token:focus-visible { outline:2px solid #9ce4d2; outline-offset:2px; }
70
+ .token-piece-choices { margin-top:8px; color:#b4cdd2; font:12px/1.7 ui-monospace,monospace; }
71
  @media(max-width:640px){.paused-token-reader { height:20vh;padding:12px 16px;font-size:16px; }}
72
+ .generation-proxy { display:none !important; }
73
+ #generation-toggle { border:0 !important; padding:0 !important; background:transparent !important; flex:3 !important; min-width:0 !important; }
74
+
75
+ .generation-toggle-button { width:100%; min-height:44px; padding:10px 18px; border:0; border-radius:10px; background:#20c7b6; color:#fff; font:600 16px/1.4 system-ui,sans-serif; cursor:pointer; box-shadow:0 2px 8px #173c381a; }
76
+ .generation-toggle-button:hover { background:#16b5a5; }
77
+ .generation-toggle-button:disabled { opacity:.65; cursor:wait; }
78
  .generation-toggle-button:focus-visible { outline:3px solid #547bba; outline-offset:2px; }
79
+
80
+ /* Model caption and compact reset remain outside the expandable dock. */
81
+ #text-overlay { position:absolute !important; top:max(18px,env(safe-area-inset-top)); left:clamp(16px,4vw,72px); right:clamp(16px,4vw,72px); width:auto !important; gap:7px !important; z-index:2; }
82
+ #model-name { padding:0 8px !important; border:0 !important; min-height:18px !important; background:transparent !important; color:#a6cbc7; text-align:right; font:12px/1.5 system-ui,sans-serif; overflow-wrap:anywhere; }
83
+ #page { position:relative !important; top:auto !important; left:auto !important; right:auto !important; width:100% !important; }
84
+ #reset-model { position:absolute !important; right:max(16px,env(safe-area-inset-right)); bottom:max(16px,env(safe-area-inset-bottom)); z-index:8; width:36px !important; height:36px !important; min-width:36px !important; min-height:36px !important; padding:0 !important; border:1px solid #86b6b366 !important; border-radius:50% !important; background:#112530ed !important; color:#c5e2dd !important; font-size:0 !important; box-shadow:0 3px 16px #0004; }
85
+ #reset-model::before { content:"\21ba"; font:24px/1 system-ui,sans-serif; }
86
+ #reset-model:hover { background:#23434d !important; color:#fff !important; }
87
+ #reset-model:focus-visible { outline:2px solid #9ce4d2; outline-offset:3px; }
88
+ #control-dock { width:min(940px,calc(100vw - 120px)) !important; }
89
+ @media(max-width:640px) { #text-overlay { top:12px;left:12px;right:12px;gap:5px !important; } #model-name { font-size:10px; } #control-dock { left:12px;transform:none;width:calc(100vw - 72px) !important; } #reset-model { right:12px;bottom:12px; } }