gphua1 commited on
Commit
ea77165
·
1 Parent(s): 299023e

Fix persistent screen shaking - disable Streamlit animations and stabilize layout

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -339,13 +339,15 @@ def run_streamlit():
339
  color: white;
340
  }
341
 
342
- /* Result box */
343
  .result-box {
344
  background: #1a1a1a;
345
  border-radius: 8px;
346
  padding: 30px;
347
  margin: 20px 0;
348
  text-align: center;
 
 
349
  }
350
 
351
  .result-pass {
@@ -368,12 +370,14 @@ def run_streamlit():
368
  font-weight: bold;
369
  }
370
 
371
- /* Metrics row */
372
  .metrics-row {
373
  display: flex;
374
  justify-content: center;
375
  gap: 40px;
376
  margin: 20px 0;
 
 
377
  }
378
 
379
  .metric {
@@ -438,6 +442,26 @@ def run_streamlit():
438
  /* Removed transform to prevent shaking */
439
  }
440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  /* Hide Streamlit branding */
442
  #MainMenu {visibility: hidden;}
443
  footer {visibility: hidden;}
@@ -570,7 +594,7 @@ def run_streamlit():
570
  label = f"Sample {idx + 1}"
571
 
572
  # Display in sidebar with improved layout
573
- col1, col2 = st.columns([1, 2])
574
  with col1:
575
  st.image(img_thumbnail, use_container_width=True)
576
  with col2:
@@ -617,7 +641,7 @@ def run_streamlit():
617
  st.markdown("""
618
  <div class="section-header">Analysis Results</div>
619
  """, unsafe_allow_html=True)
620
- col1, col2 = st.columns([1, 2])
621
  with col1:
622
  st.image(image, use_container_width=True)
623
 
 
339
  color: white;
340
  }
341
 
342
+ /* Result box - fixed positioning to prevent shaking */
343
  .result-box {
344
  background: #1a1a1a;
345
  border-radius: 8px;
346
  padding: 30px;
347
  margin: 20px 0;
348
  text-align: center;
349
+ position: relative;
350
+ will-change: auto;
351
  }
352
 
353
  .result-pass {
 
370
  font-weight: bold;
371
  }
372
 
373
+ /* Metrics row - fixed positioning to prevent shaking */
374
  .metrics-row {
375
  display: flex;
376
  justify-content: center;
377
  gap: 40px;
378
  margin: 20px 0;
379
+ position: relative;
380
+ will-change: auto;
381
  }
382
 
383
  .metric {
 
442
  /* Removed transform to prevent shaking */
443
  }
444
 
445
+ /* Prevent layout shifts and stabilize columns */
446
+ [data-testid="column"] {
447
+ transition: none !important;
448
+ transform: none !important;
449
+ }
450
+
451
+ [data-testid="stHorizontalBlock"] {
452
+ transition: none !important;
453
+ transform: none !important;
454
+ }
455
+
456
+ /* Disable all Streamlit element animations */
457
+ .stApp > div {
458
+ transition: none !important;
459
+ }
460
+
461
+ div[data-testid="stDecoration"] {
462
+ display: none !important;
463
+ }
464
+
465
  /* Hide Streamlit branding */
466
  #MainMenu {visibility: hidden;}
467
  footer {visibility: hidden;}
 
594
  label = f"Sample {idx + 1}"
595
 
596
  # Display in sidebar with improved layout
597
+ col1, col2 = st.columns([1, 2], gap="large")
598
  with col1:
599
  st.image(img_thumbnail, use_container_width=True)
600
  with col2:
 
641
  st.markdown("""
642
  <div class="section-header">Analysis Results</div>
643
  """, unsafe_allow_html=True)
644
+ col1, col2 = st.columns([1, 2], gap="large")
645
  with col1:
646
  st.image(image, use_container_width=True)
647