Spaces:
Running

abyss2009 commited on
Commit
9064feb
·
verified ·
1 Parent(s): c6ec748

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -50
app.py CHANGED
@@ -264,11 +264,14 @@ def select_language(label: str):
264
  )
265
 
266
 
267
- # -------------- CSS 让它长得像 Bucky 那种 --------------
268
 
269
  CSS = """
270
- #ca-wrapper {font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;}
 
 
271
 
 
272
  #ca-header {
273
  position: relative;
274
  background:#002f5f;
@@ -302,9 +305,11 @@ CSS = """
302
  align-items:center;
303
  justify-content:center;
304
  }
305
- #ca-lang-btn button:hover {filter:brightness(1.03);}
 
 
306
 
307
- /* 语言面板:右上角小卡片 */
308
  #ca-lang-panel {
309
  position:absolute;
310
  top:52px;
@@ -314,67 +319,27 @@ CSS = """
314
  background:#fff;
315
  border-radius:12px;
316
  box-shadow:0 12px 32px rgba(0,0,0,.35);
317
- padding:10px 10px 6px 10px;
318
  z-index:50;
319
  }
320
 
321
- /* 去掉 Gradio 默认 label */
322
- #ca-lang-panel label, #ca-lang-panel .label, #ca-lang-panel .form-label {
323
- display:none !important;
324
- }
325
-
326
- /* 搜索框样式 */
327
  #ca-lang-search textarea {
328
  resize:none !important;
329
  min-height:34px !important;
330
  max-height:34px !important;
331
- padding:6px 10px 6px 34px !important;
332
  font-size:13px !important;
333
  border-radius:999px !important;
334
  border:1px solid #d1d5db !important;
335
  }
336
 
337
- /* 简单画一个“🔍”图标 */
338
- #ca-lang-panel .search-wrapper {
339
- position:relative;
340
- margin-bottom:6px;
341
- }
342
- #ca-lang-panel .search-wrapper::before {
343
- content:"\\1F50D";
344
- position:absolute;
345
- left:12px;
346
- top:7px;
347
- font-size:14px;
348
- color:#6b7280;
349
- }
350
-
351
  /* 语言列表:竖直滚动 */
352
  #ca-lang-radio {
353
  max-height:270px;
354
  overflow-y:auto;
355
- border-top:1px solid #e5e7eb;
356
- margin-top:6px;
357
- padding-top:4px;
358
  }
359
- #ca-lang-radio .wrap {
360
- padding-right:4px;
361
- }
362
- #ca-lang-radio input[type="radio"] {
363
- margin-right:8px;
364
- }
365
- #ca-lang-radio label {
366
- display:flex;
367
- align-items:center;
368
- padding:6px 6px;
369
- border-radius:6px;
370
- cursor:pointer;
371
- font-size:13px;
372
- }
373
- #ca-lang-radio label:hover {
374
- background:#f3f4f6;
375
- }
376
-
377
- /* Chatbot 主体保持默认 */
378
  """
379
 
380
  # -------------- Gradio UI --------------
@@ -390,8 +355,6 @@ with gr.Blocks(fill_height=True, css=CSS, elem_id="ca-wrapper") as demo:
390
 
391
  # 右上角语言面板
392
  with gr.Column(visible=False, elem_id="ca-lang-panel") as lang_panel:
393
- # 包一层 div,用 CSS 加 🔍 图标
394
- gr.HTML('<div class="search-wrapper"></div>')
395
  lang_search = gr.Textbox(
396
  value="",
397
  placeholder=search_placeholder_for("en"),
 
264
  )
265
 
266
 
267
+ # -------------- CSS:顶部栏 + 右上角小面板 --------------
268
 
269
  CSS = """
270
+ #ca-wrapper {
271
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
272
+ }
273
 
274
+ /* 顶部蓝条 */
275
  #ca-header {
276
  position: relative;
277
  background:#002f5f;
 
305
  align-items:center;
306
  justify-content:center;
307
  }
308
+ #ca-lang-btn button:hover {
309
+ filter:brightness(1.03);
310
+ }
311
 
312
+ /* 语言面板:右上角抽屉式小卡片 */
313
  #ca-lang-panel {
314
  position:absolute;
315
  top:52px;
 
319
  background:#fff;
320
  border-radius:12px;
321
  box-shadow:0 12px 32px rgba(0,0,0,.35);
322
+ padding:10px 10px 8px 10px;
323
  z-index:50;
324
  }
325
 
326
+ /* 搜索框 */
 
 
 
 
 
327
  #ca-lang-search textarea {
328
  resize:none !important;
329
  min-height:34px !important;
330
  max-height:34px !important;
331
+ padding:6px 10px !important;
332
  font-size:13px !important;
333
  border-radius:999px !important;
334
  border:1px solid #d1d5db !important;
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  /* 语言列表:竖直滚动 */
338
  #ca-lang-radio {
339
  max-height:270px;
340
  overflow-y:auto;
341
+ margin-top:8px;
 
 
342
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
  """
344
 
345
  # -------------- Gradio UI --------------
 
355
 
356
  # 右上角语言面板
357
  with gr.Column(visible=False, elem_id="ca-lang-panel") as lang_panel:
 
 
358
  lang_search = gr.Textbox(
359
  value="",
360
  placeholder=search_placeholder_for("en"),