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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -15
app.py CHANGED
@@ -567,21 +567,19 @@ def medical_chat(user_input, history):
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,12 +588,11 @@ with gr.Blocks(theme=gr.themes.Soft(), css="""
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("""
 
567
 
568
  # 构建 Gradio 界面
569
  with gr.Blocks(theme=gr.themes.Soft(), css="""
570
+ .container { display: flex; flex-direction: row; }
571
+ .left-column { flex: 3; }
572
+ .right-column { flex: 1; }
573
+ .chatbot-container { height: 450px; }
 
 
574
  """) as demo:
575
+ gr.Markdown("# 🏥 专业医疗咨询助手")
576
+ gr.Markdown("### 本系统提供基于AI的医疗咨询服务,仅供参考,不能替代专业医生的诊断")
577
 
578
+ # 创建两列布局
579
+ with gr.Row(elem_id="container", equal_height=True):
580
  # 左侧列 - 主聊天界面
581
+ with gr.Column(scale=3, elem_id="left-column"):
582
+ gr.Markdown("### 请描述您的症状或健康问题")
583
  chat_interface = gr.ChatInterface(
584
  fn=medical_chat,
585
  examples=[
 
588
  "孩子有轻微发烧,需要去医院吗?"
589
  ],
590
  title="症状咨询",
591
+ chatbot=gr.Chatbot(height=450)
 
592
  )
593
 
594
  # 右侧列 - 辅助信息
595
+ with gr.Column(scale=1, elem_id="right-column"):
596
  # 添加医疗免责声明
597
  with gr.Accordion("医疗免责声明", open=True):
598
  gr.Markdown("""