North-ml commited on
Commit
d0746fc
1 Parent(s): afd51cf

Refine demo layout and collapse controls

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -332,7 +332,7 @@ with gr.Blocks(title="Ember 路 North ML") as demo:
332
  with gr.Column(scale=3, elem_id="chat-column"):
333
  gr.Markdown("# What can I help you explore?\nAsk Aurora a question or choose a prompt below.", elem_id="hero")
334
  chatbot = gr.Chatbot(
335
- height=560,
336
  show_label=False,
337
  placeholder=CHAT_PLACEHOLDER,
338
  elem_id="chatbot",
@@ -348,11 +348,11 @@ with gr.Blocks(title="Ember 路 North ML") as demo:
348
  label="Try a prompt",
349
  elem_id="prompt-starters",
350
  )
351
- with gr.Column(scale=1, min_width=220, elem_id="settings-panel"):
352
- gr.Markdown("### Generation", elem_id="settings-title")
353
- max_new_tokens = gr.Slider(minimum=32, maximum=192, value=DEFAULT_MAX_NEW, step=16, label="Response length")
354
- temperature = gr.Slider(minimum=0, maximum=0.8, value=0, step=0.05, label="Temperature", info="0 keeps replies consistent.")
355
- gr.Markdown("### Runtime\n`Aurora Proelia 路 207M`\n\nCPU inference is intentionally slower on the first request while the model loads.", elem_classes=["settings-help"])
356
 
357
  submit.click(chat, inputs=[message, chatbot, max_new_tokens, temperature], outputs=chatbot, api_name="chat", concurrency_limit=1)
358
  message.submit(chat, inputs=[message, chatbot, max_new_tokens, temperature], outputs=chatbot, api_name="chat_submit", concurrency_limit=1)
@@ -375,34 +375,34 @@ if __name__ == "__main__":
375
  .cpu-pill { display: flex; gap: 7px; align-items: center; }
376
  .status-dot { width: 7px; height: 7px; border-radius: 99px; background: #22c55e; box-shadow: 0 0 10px #86efac; }
377
  #app-shell { gap: 0 !important; min-height: calc(100vh - 76px); }
378
- #sidebar, #settings-panel { background: var(--panel); border: 0; padding: 30px 25px; min-height: calc(100vh - 76px); }
379
  #sidebar { border-right: 1px solid var(--line); }
380
- #settings-panel { border-left: 1px solid var(--line); }
381
  #new-chat { border: 1px solid #dce3ee !important; border-radius: 11px !important; color: #1d293d !important; background: #fff !important; box-shadow: 0 2px 8px rgba(20,35,60,.05); }
382
  #model-card { margin-top: 32px; padding: 18px; border-radius: 15px; background: linear-gradient(145deg, #eef5ff, #f8fbff); border: 1px solid #dbe8fb; }
383
  #model-card h3 { margin-top: 0; color: #1e4da1; }
384
  .sidebar-copy, .settings-help { color: var(--muted); font-size: 12px; line-height: 1.7; }
385
  .sidebar-footer { position: absolute; bottom: 22px; font-size: 12px; }
386
  .sidebar-footer a { color: #718096; text-decoration: none; }
387
- #chat-column { padding: 52px clamp(22px, 5vw, 82px) 32px; max-width: 980px; margin: 0 auto; }
388
  #hero { text-align: center; margin: 0 auto 24px; max-width: 640px; }
389
  #hero h1 { color: #18243a; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.055em; line-height: 1.1; }
390
  #hero p { color: var(--muted); }
391
  #chatbot { background: transparent !important; box-shadow: none !important; border: 0 !important; }
392
  #chatbot .message { border-radius: 17px !important; border: 1px solid var(--line) !important; }
393
- #composer { margin-top: 12px; }
394
  #composer textarea { background: #fff !important; border: 1px solid #dbe2ed !important; border-radius: 14px !important; padding: 15px 16px !important; min-height: 56px !important; box-shadow: 0 5px 20px rgba(33,52,84,.06); }
395
  #composer-actions { margin-top: 8px; justify-content: flex-end; }
396
  #send-button { background: var(--ember) !important; border: 0 !important; border-radius: 10px !important; }
397
  #clear-button { background: #fff !important; border: 1px solid #dbe2ed !important; border-radius: 10px !important; color: #34445c !important; }
398
- #prompt-starters { margin-top: 22px; }
 
 
399
  #prompt-starters .examples-holder { gap: 8px; }
400
  #prompt-starters button { border: 1px solid #dbe3ef !important; background: #fff !important; color: #44546b !important; border-radius: 999px !important; }
401
- .empty-chat { text-align: center; color: #7a879b; padding-top: 160px; }
402
  .empty-chat img { display: block; width: 54px; height: 54px; object-fit: contain; margin: 0 auto 13px; }
403
  .empty-chat small { display: block; margin-top: 8px; color: #9aa6b8; }
404
- #settings-panel .block { border-color: var(--line) !important; }
405
  footer { display: none !important; }
406
- @media (max-width: 900px) { #sidebar, #settings-panel { min-height: auto; border: 0; } #settings-panel { display: none; } #chat-column { padding: 28px 16px; } .topbar { padding: 0 16px; } .topbar-actions a { display: none; } }
407
  """,
408
  )
 
332
  with gr.Column(scale=3, elem_id="chat-column"):
333
  gr.Markdown("# What can I help you explore?\nAsk Aurora a question or choose a prompt below.", elem_id="hero")
334
  chatbot = gr.Chatbot(
335
+ height=470,
336
  show_label=False,
337
  placeholder=CHAT_PLACEHOLDER,
338
  elem_id="chatbot",
 
348
  label="Try a prompt",
349
  elem_id="prompt-starters",
350
  )
351
+ with gr.Accordion("Generation settings", open=False, elem_id="generation-panel"):
352
+ with gr.Row(elem_id="generation-row"):
353
+ max_new_tokens = gr.Slider(minimum=32, maximum=192, value=DEFAULT_MAX_NEW, step=16, label="Response length")
354
+ temperature = gr.Slider(minimum=0, maximum=0.8, value=0, step=0.05, label="Temperature", info="0 keeps replies consistent.")
355
+ gr.Markdown("Aurora Proelia 路 207M runs on CPU. The first response may take longer while the model loads.", elem_classes=["settings-help"])
356
 
357
  submit.click(chat, inputs=[message, chatbot, max_new_tokens, temperature], outputs=chatbot, api_name="chat", concurrency_limit=1)
358
  message.submit(chat, inputs=[message, chatbot, max_new_tokens, temperature], outputs=chatbot, api_name="chat_submit", concurrency_limit=1)
 
375
  .cpu-pill { display: flex; gap: 7px; align-items: center; }
376
  .status-dot { width: 7px; height: 7px; border-radius: 99px; background: #22c55e; box-shadow: 0 0 10px #86efac; }
377
  #app-shell { gap: 0 !important; min-height: calc(100vh - 76px); }
378
+ #sidebar { background: var(--panel); border: 0; padding: 30px 25px; min-height: calc(100vh - 76px); }
379
  #sidebar { border-right: 1px solid var(--line); }
 
380
  #new-chat { border: 1px solid #dce3ee !important; border-radius: 11px !important; color: #1d293d !important; background: #fff !important; box-shadow: 0 2px 8px rgba(20,35,60,.05); }
381
  #model-card { margin-top: 32px; padding: 18px; border-radius: 15px; background: linear-gradient(145deg, #eef5ff, #f8fbff); border: 1px solid #dbe8fb; }
382
  #model-card h3 { margin-top: 0; color: #1e4da1; }
383
  .sidebar-copy, .settings-help { color: var(--muted); font-size: 12px; line-height: 1.7; }
384
  .sidebar-footer { position: absolute; bottom: 22px; font-size: 12px; }
385
  .sidebar-footer a { color: #718096; text-decoration: none; }
386
+ #chat-column { padding: 38px clamp(22px, 5vw, 82px) 32px; max-width: 980px; margin: 0 auto; }
387
  #hero { text-align: center; margin: 0 auto 24px; max-width: 640px; }
388
  #hero h1 { color: #18243a; font-size: clamp(26px, 3vw, 40px); letter-spacing: -.055em; line-height: 1.1; }
389
  #hero p { color: var(--muted); }
390
  #chatbot { background: transparent !important; box-shadow: none !important; border: 0 !important; }
391
  #chatbot .message { border-radius: 17px !important; border: 1px solid var(--line) !important; }
392
+ #composer { margin-top: 8px; }
393
  #composer textarea { background: #fff !important; border: 1px solid #dbe2ed !important; border-radius: 14px !important; padding: 15px 16px !important; min-height: 56px !important; box-shadow: 0 5px 20px rgba(33,52,84,.06); }
394
  #composer-actions { margin-top: 8px; justify-content: flex-end; }
395
  #send-button { background: var(--ember) !important; border: 0 !important; border-radius: 10px !important; }
396
  #clear-button { background: #fff !important; border: 1px solid #dbe2ed !important; border-radius: 10px !important; color: #34445c !important; }
397
+ #generation-panel { margin-top: 18px; border: 1px solid var(--line) !important; border-radius: 12px !important; background: #fff !important; }
398
+ #generation-row { gap: 18px; }
399
+ #prompt-starters { margin-top: 18px; }
400
  #prompt-starters .examples-holder { gap: 8px; }
401
  #prompt-starters button { border: 1px solid #dbe3ef !important; background: #fff !important; color: #44546b !important; border-radius: 999px !important; }
402
+ .empty-chat { text-align: center; color: #7a879b; padding-top: 95px; }
403
  .empty-chat img { display: block; width: 54px; height: 54px; object-fit: contain; margin: 0 auto 13px; }
404
  .empty-chat small { display: block; margin-top: 8px; color: #9aa6b8; }
 
405
  footer { display: none !important; }
406
+ @media (max-width: 900px) { #sidebar { min-height: auto; border: 0; } #chat-column { padding: 28px 16px; } .topbar { padding: 0 16px; } .topbar-actions a { display: none; } }
407
  """,
408
  )