Nicha1234 commited on
Commit
1252899
·
verified ·
1 Parent(s): 70bb5ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -16,8 +16,6 @@ st.markdown("""
16
  <style>
17
  /* CSS แก้ปัญหาการสั่นของหน้าจอ */
18
  .stApp { transition: none !important; }
19
- /* กำหนดความสูงตายตัวให้กับ container กราฟ */
20
- .fixed-height-chart { min-height: 500px; display: flex; align-items: center; justify-content: center; }
21
  html, body, [class*="st-"] {
22
  font-size: 18px;
23
  }
@@ -110,9 +108,9 @@ def draw_kspace_diagram():
110
  ax.annotate('', xy=(0.95, 0), xytext=(-0.95, 0), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=2))
111
  ax.annotate('', xy=(0, 0.95), xytext=(0, -0.95), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=2))
112
 
113
- # ตัวอักษรบอกทิศทาง +kx, -kx, +ky, -ky
114
  ax.text(1.1, 0, '+kx', fontsize=20, fontweight='bold', va='center')
115
- ax.text(-1.1, 0, '-kx', fontsize=20, fontweight='bold', va='center', ha='right')
116
  ax.text(0, 1.1, '+ky', fontsize=20, fontweight='bold', ha='center')
117
  ax.text(0, -1.1, '-ky', fontsize=20, fontweight='bold', ha='center', va='top')
118
 
@@ -325,16 +323,14 @@ with col_main:
325
 
326
  st.progress((st.session_state.fill_step + 1) / total_anim_steps)
327
 
328
- # ใช้ตีรอบ Container เพื่อกันกระโดดสั่ขอLayout
329
- st.markdown('<div class="fixed-height-chart">', unsafe_allow_html=True)
330
- anim_placeholder = st.empty()
331
- with anim_placeholder.container():
332
- col_anim1, col_anim2 = st.columns([1, 1])
333
- with col_anim1:
334
- st.image(draw_pulse_sequence(st.session_state.fill_step, total_anim_steps), use_container_width=True)
335
- with col_anim2:
336
- st.image(draw_kspace_filling(st.session_state.fill_step, total_anim_steps), use_container_width=True)
337
- st.markdown('</div>', unsafe_allow_html=True)
338
 
339
  st.markdown("""
340
  ---
 
16
  <style>
17
  /* CSS แก้ปัญหาการสั่นของหน้าจอ */
18
  .stApp { transition: none !important; }
 
 
19
  html, body, [class*="st-"] {
20
  font-size: 18px;
21
  }
 
108
  ax.annotate('', xy=(0.95, 0), xytext=(-0.95, 0), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=2))
109
  ax.annotate('', xy=(0, 0.95), xytext=(0, -0.95), arrowprops=dict(arrowstyle='<|-|>', color='black', lw=2))
110
 
111
+ # ตัวอักษรบอกทิศทาง +kx, -kx, +ky, -ky (ปรับระยะ -kx ให้ห่างเส้นมากขึ้น)
112
  ax.text(1.1, 0, '+kx', fontsize=20, fontweight='bold', va='center')
113
+ ax.text(-1.2, 0, '-kx', fontsize=20, fontweight='bold', va='center', ha='right')
114
  ax.text(0, 1.1, '+ky', fontsize=20, fontweight='bold', ha='center')
115
  ax.text(0, -1.1, '-ky', fontsize=20, fontweight='bold', ha='center', va='top')
116
 
 
323
 
324
  st.progress((st.session_state.fill_step + 1) / total_anim_steps)
325
 
326
+ # ้ปญหาหจอโหลดกระตุก โดยใช้ st.empty() คุมทีละภาพแทที่จะคุมทั้Container
327
+ col_anim1, col_anim2 = st.columns([1, 1])
328
+ with col_anim1:
329
+ img1_ph = st.empty()
330
+ img1_ph.image(draw_pulse_sequence(st.session_state.fill_step, total_anim_steps), use_container_width=True)
331
+ with col_anim2:
332
+ img2_ph = st.empty()
333
+ img2_ph.image(draw_kspace_filling(st.session_state.fill_step, total_anim_steps), use_container_width=True)
 
 
334
 
335
  st.markdown("""
336
  ---