hermi612 commited on
Commit
f94d2cf
·
verified ·
1 Parent(s): 9fe9f63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -566,15 +566,22 @@ def medical_chat(user_input, history):
566
  return local_fallback_response(user_input)
567
 
568
  # 构建 Gradio 界面
569
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
570
- gr.Markdown("# 🏥 专业医疗咨询助手")
571
- gr.Markdown("### 本系统提供基于AI的医疗咨询服务,仅供参考,不能替代专业医生的诊断")
 
 
 
 
 
 
 
572
 
573
- # 创建两列布局
574
- with gr.Row():
575
  # 左侧列 - 主聊天界面
576
- with gr.Column(scale=3):
577
- gr.Markdown("### 请描述您的症状或健康问题")
578
  chat_interface = gr.ChatInterface(
579
  fn=medical_chat,
580
  examples=[
@@ -583,11 +590,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
583
  "孩子有轻微发烧,需要去医院吗?"
584
  ],
585
  title="症状咨询",
586
- chatbot=gr.Chatbot(height=500) # 调整聊天窗口高度以与右侧对齐
 
587
  )
588
 
589
  # 右侧列 - 辅助信息
590
- with gr.Column(scale=1):
591
  # 添加医疗免责声明
592
  with gr.Accordion("医疗免责声明", open=True):
593
  gr.Markdown("""
 
566
  return local_fallback_response(user_input)
567
 
568
  # 构建 Gradio 界面
569
+ with gr.Blocks(theme=gr.themes.Soft(), css="""
570
+ .container {display: flex; flex-direction: row; height: 600px;}
571
+ .chat-column {flex: 3; height: 100%;}
572
+ .info-column {flex: 1; height: 100%; overflow-y: auto;}
573
+ .chat-interface {height: 100%;}
574
+ .chat-window {height: 450px !important; overflow-y: auto;}
575
+ .title-text {margin-bottom: 5px;}
576
+ """) as demo:
577
+ gr.Markdown("# 🏥 专业医疗咨询助手", elem_classes=["title-text"])
578
+ gr.Markdown("### 本系统提供基于AI的医疗咨询服务,仅供参考,不能替代专业医生的诊断", elem_classes=["title-text"])
579
 
580
+ # 创建两列布局,使用自定义CSS类
581
+ with gr.Row(elem_classes=["container"]):
582
  # 左侧列 - 主聊天界面
583
+ with gr.Column(elem_classes=["chat-column"]):
584
+ gr.Markdown("### 请描述您的症状或健康问题", elem_classes=["title-text"])
585
  chat_interface = gr.ChatInterface(
586
  fn=medical_chat,
587
  examples=[
 
590
  "孩子有轻微发烧,需要去医院吗?"
591
  ],
592
  title="症状咨询",
593
+ chatbot=gr.Chatbot(elem_classes=["chat-window"]),
594
+ elem_classes=["chat-interface"]
595
  )
596
 
597
  # 右侧列 - 辅助信息
598
+ with gr.Column(elem_classes=["info-column"]):
599
  # 添加医疗免责声明
600
  with gr.Accordion("医疗免责声明", open=True):
601
  gr.Markdown("""