Miemie123 commited on
Commit
bf482e7
·
verified ·
1 Parent(s): 55bc8ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -57
app.py CHANGED
@@ -704,35 +704,16 @@ def render_assessment_page():
704
  padding-top: 0 !important;
705
  }
706
 
707
- /* 额外保险:检查列布局的父容器 */
708
  .stColumns {
709
  gap: 0 !important;
710
  }
711
-
712
- .sidebar-title {
713
- white-space: nowrap;
714
- overflow: hidden;
715
- text-overflow: ellipsis;
716
- margin-bottom: 1rem;
717
- }
718
- .centered-content {
719
- display: flex;
720
- flex-direction: column;
721
- align-items: center;
722
- justify-content: center;
723
- }
724
- .stButton > button {
725
- width: 100%;
726
- margin-top: 0.5rem;
727
- }
728
  </style>
729
  """, unsafe_allow_html=True)
730
 
731
  chat_manager = ChatManager()
732
  chat_manager.initialize_state()
733
- chat_manager.update_progress() # 别忘了加这句,否则不会调用 API/更新 UI
734
 
735
- # 自动刷新(如果还有消息未显示)
736
  if st.session_state.chat_step < len(st.session_state.chat_history):
737
  st_autorefresh(interval=1500, key="chat_autorefresh")
738
 
@@ -749,49 +730,22 @@ def render_assessment_page():
749
  if key not in st.session_state:
750
  st.session_state[key] = default
751
 
752
- # if st.session_state.show_sidebar:
753
- # with st.sidebar:
754
- # st.markdown("### 📂 Select a sample knee image")
755
- # PREDEFINED_IMAGES = {
756
- # "Knee Image A": "images/knee_sample_1.png",
757
- # }
758
- # for idx, (label, path) in enumerate(PREDEFINED_IMAGES.items()):
759
- # col1, col2, col3 = st.columns([1, 2, 1])
760
- # with col2:
761
- # st.image(path, width=150, caption=label)
762
- # if st.button("✅ Select", key=f"select_{idx}"):
763
- # st.session_state.selected_image_path = path
764
- # st.session_state.selected_image_label = label
765
- # st.session_state.show_sidebar = False
766
- # st.rerun()
767
  if st.session_state.show_sidebar:
768
  with st.sidebar:
769
- # 使用自定义CSS类防止标题换行
770
- st.markdown('<h3 class="sidebar-title">📂 Select a sample image</h3>', unsafe_allow_html=True)
771
-
772
  PREDEFINED_IMAGES = {
773
  "Knee Image A": "images/knee_sample_1.png",
774
  }
775
-
776
  for idx, (label, path) in enumerate(PREDEFINED_IMAGES.items()):
777
- # 使用居中容器包裹内容
778
- st.markdown('<div class="centered-content">', unsafe_allow_html=True)
779
-
780
- # 显示图像并居中
781
- st.image(path, width=150, caption=label)
782
-
783
- # 选择按钮,通过CSS设置宽度为100%实现居中效果
784
- if st.button("✅ Select", key=f"select_{idx}"):
785
- st.session_state.selected_image_path = path
786
- st.session_state.selected_image_label = label
787
- st.session_state.show_sidebar = False
788
- st.rerun()
789
-
790
- st.markdown('</div>', unsafe_allow_html=True)
791
-
792
- # 图片之间添加间距
793
- if idx != len(PREDEFINED_IMAGES) - 1:
794
- st.markdown("<br>", unsafe_allow_html=True)
795
 
796
  st.markdown('<p class="chat-note">Demo chat interface (display only).</p>', unsafe_allow_html=True)
797
 
 
704
  padding-top: 0 !important;
705
  }
706
 
 
707
  .stColumns {
708
  gap: 0 !important;
709
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
710
  </style>
711
  """, unsafe_allow_html=True)
712
 
713
  chat_manager = ChatManager()
714
  chat_manager.initialize_state()
715
+ chat_manager.update_progress()
716
 
 
717
  if st.session_state.chat_step < len(st.session_state.chat_history):
718
  st_autorefresh(interval=1500, key="chat_autorefresh")
719
 
 
730
  if key not in st.session_state:
731
  st.session_state[key] = default
732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  if st.session_state.show_sidebar:
734
  with st.sidebar:
735
+ st.markdown("### 📂 Select a sample image")
 
 
736
  PREDEFINED_IMAGES = {
737
  "Knee Image A": "images/knee_sample_1.png",
738
  }
 
739
  for idx, (label, path) in enumerate(PREDEFINED_IMAGES.items()):
740
+ col1, col2, col3 = st.columns([1, 2, 1])
741
+ with col2:
742
+ st.image(path, width=150, caption=label)
743
+ if st.button("✅ Select", key=f"select_{idx}"):
744
+ st.session_state.selected_image_path = path
745
+ st.session_state.selected_image_label = label
746
+ st.session_state.show_sidebar = False
747
+ st.rerun()
748
+
 
 
 
 
 
 
 
 
 
749
 
750
  st.markdown('<p class="chat-note">Demo chat interface (display only).</p>', unsafe_allow_html=True)
751