milwright commited on
Commit
bf1d37e
Β·
1 Parent(s): 3cede77

Fix vertical text in file upload drag-and-drop area and enhance uploader UI

Browse files
Files changed (1) hide show
  1. app.py +68 -1
app.py CHANGED
@@ -470,7 +470,74 @@ with main_tab1:
470
  Using the latest `mistral-ocr-latest` model for advanced document understanding.
471
  """)
472
 
473
- uploaded_file = st.file_uploader("Choose a PDF or image file to get started", type=["pdf", "png", "jpg", "jpeg"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474
 
475
  # Removed seed prompt instructions from here, moving to sidebar
476
 
 
470
  Using the latest `mistral-ocr-latest` model for advanced document understanding.
471
  """)
472
 
473
+ # Add enhanced CSS to fix the vertical text and improve the drag and drop area visually
474
+ st.markdown("""
475
+ <style>
476
+ /* Fix color and text orientation */
477
+ .uploadedFile, .uploadedFileData, .stFileUploader {
478
+ color: #333333 !important;
479
+ }
480
+
481
+ /* Fix the text orientation for all elements in the uploader */
482
+ .stFileUploader label span,
483
+ .stFileUploader label div,
484
+ .stFileUploader p,
485
+ .stFileUploader div[data-testid="stFileUploadDropzone"] span,
486
+ .stFileUploader div[data-testid="stFileUploadDropzone"] div,
487
+ .stFileUploader div[data-testid="stFileUploadDropzone"] label,
488
+ .stFileUploader div[data-testid="stFileUploadDropzone"] p {
489
+ white-space: normal !important;
490
+ display: inline-block !important;
491
+ height: auto !important;
492
+ text-orientation: mixed !important;
493
+ writing-mode: horizontal-tb !important;
494
+ width: auto !important;
495
+ text-align: center !important;
496
+ color: #424242 !important;
497
+ font-weight: 400 !important;
498
+ }
499
+
500
+ /* Enhance the drop zone appearance */
501
+ .stFileUploader > section > div,
502
+ .stFileUploader div[data-testid="stFileUploadDropzone"] {
503
+ display: flex !important;
504
+ flex-direction: column !important;
505
+ align-items: center !important;
506
+ justify-content: center !important;
507
+ text-align: center !important;
508
+ height: auto !important;
509
+ min-height: 180px !important;
510
+ background-color: #f5f5f5 !important;
511
+ border: 2px dashed #bdbdbd !important;
512
+ border-radius: 8px !important;
513
+ transition: background-color 0.3s, border-color 0.3s !important;
514
+ padding: 20px !important;
515
+ margin-bottom: 20px !important;
516
+ }
517
+
518
+ /* Hover effect for better user feedback */
519
+ .stFileUploader > section > div:hover,
520
+ .stFileUploader div[data-testid="stFileUploadDropzone"]:hover {
521
+ background-color: #e8f4fd !important;
522
+ border-color: #2196f3 !important;
523
+ }
524
+
525
+ /* Add visual icon for upload */
526
+ .stFileUploader div[data-testid="stFileUploadDropzone"]::before {
527
+ content: "πŸ“„" !important;
528
+ font-size: 36px !important;
529
+ display: block !important;
530
+ margin-bottom: 10px !important;
531
+ }
532
+ </style>
533
+ """, unsafe_allow_html=True)
534
+
535
+ # Add visual label above the file uploader
536
+ st.markdown('<div style="margin-bottom:8px; font-weight:500; color:#212121;">πŸ“„ Upload Historical Document</div>', unsafe_allow_html=True)
537
+
538
+ # Enhanced file uploader with better help text
539
+ uploaded_file = st.file_uploader("Drag and drop PDFs or images here", type=["pdf", "png", "jpg", "jpeg"],
540
+ help="Supports PDFs, JPGs, PNGs and other image formats")
541
 
542
  # Removed seed prompt instructions from here, moving to sidebar
543