BrilliantCoolHuge commited on
Commit
4b27ebf
·
verified ·
1 Parent(s): f92a360

兼容手机、平板展示

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -576,25 +576,31 @@ def build_ui():
576
  template_names = get_template_choices_and_bgm_visible()
577
 
578
  css = """
579
- html, body, #root, .gradio-container { height: 100%; overflow: hidden; }
580
- #main-row { height: 100vh; overflow: hidden; }
581
  #left-panel, #right-panel {
582
- height: 100vh;
583
- overflow-y: auto;
584
  padding: 12px;
585
  }
586
  #left-panel { border-right: 1px solid #eee; }
 
 
 
 
 
 
 
587
  /* 紧凑按钮样式 */
588
  .compact-btn button { padding: 4px 10px !important; min-height: 30px !important; height: 30px !important; }
589
  .compact-row { gap: 8px !important; }
590
  """
591
 
592
- with gr.Blocks(title="DiffSinger WebUI", theme=gr.themes.Soft(), css=css) as demo:
593
  with gr.Row(elem_id="main-row"):
594
  # 左栏:控制/预览(固定)
595
  with gr.Column(elem_id="left-panel", scale=1, min_width=360):
596
  # 左栏标题与模型/模板选择、上传/下载
597
  gr.Markdown("## DiffSinger WebUI")
 
598
  model_sel = gr.Dropdown(choices=model_choices, label="模型选择", value=(model_choices[0] if model_choices else None))
599
  template_sel = gr.Dropdown(choices=template_names, label="模板选择", value=(template_names[0] if template_names else None))
600
  with gr.Row(elem_classes=["compact-row"]):
 
576
  template_names = get_template_choices_and_bgm_visible()
577
 
578
  css = """
579
+ /* 全局:启用页面整体滚动,移除左右分栏独立滚动 */
580
+ #main-row { gap: 12px; }
581
  #left-panel, #right-panel {
 
 
582
  padding: 12px;
583
  }
584
  #left-panel { border-right: 1px solid #eee; }
585
+
586
+ /* 响应式:窄屏下上下布局,宽屏左右布局 */
587
+ @media (max-width: 900px) {
588
+ #main-row { flex-direction: column !important; }
589
+ #left-panel { border-right: none; border-bottom: 1px solid #eee; }
590
+ }
591
+
592
  /* 紧凑按钮样式 */
593
  .compact-btn button { padding: 4px 10px !important; min-height: 30px !important; height: 30px !important; }
594
  .compact-row { gap: 8px !important; }
595
  """
596
 
597
+ with gr.Blocks(title="DiffSinger WebUI", theme=gr.themes.Soft(), css=css, head='<meta name="description" content="项目地址 https://github.com/bingcheng1998/diffsinger-webui">') as demo:
598
  with gr.Row(elem_id="main-row"):
599
  # 左栏:控制/预览(固定)
600
  with gr.Column(elem_id="left-panel", scale=1, min_width=360):
601
  # 左栏标题与模型/模板选择、上传/下载
602
  gr.Markdown("## DiffSinger WebUI")
603
+ gr.Markdown("项目地址: [https://github.com/bingcheng1998/diffsinger-webui](https://github.com/bingcheng1998/diffsinger-webui)")
604
  model_sel = gr.Dropdown(choices=model_choices, label="模型选择", value=(model_choices[0] if model_choices else None))
605
  template_sel = gr.Dropdown(choices=template_names, label="模板选择", value=(template_names[0] if template_names else None))
606
  with gr.Row(elem_classes=["compact-row"]):