ApsidalSolid4 commited on
Commit
7eb366f
·
verified ·
1 Parent(s): 4a931a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -36
app.py CHANGED
@@ -780,64 +780,50 @@ def create_interface():
780
  color: white !important;
781
  }
782
 
783
- /* Make upload button container match radio button container size */
784
  .file-upload-container {
785
  margin-left: 15px;
786
- width: 150px;
787
- height: 40px;
788
  display: inline-block;
789
- vertical-align: middle;
790
- position: relative;
791
  }
792
 
793
- /* Hide ALL the default file upload elements */
794
  .file-upload-container .file-preview,
795
- .file-upload-container .file-drop,
796
- .file-upload-container p,
797
  .file-upload-container svg,
798
- .file-upload-container [data-testid="chunkFileDropArea"],
799
- .file-upload-container [data-testid="droparea"] {
800
  display: none !important;
801
  }
802
 
803
- /* Style the button to look exactly like we want */
804
- .file-upload-container > div:last-child {
805
- position: absolute !important;
806
- top: 0 !important;
807
- left: 0 !important;
808
- width: 100% !important;
809
- height: 40px !important;
810
- padding: 0 15px !important;
811
  background-color: #f0f0f0 !important;
812
  border: 1px solid #d9d9d9 !important;
813
  border-radius: 4px !important;
 
 
814
  display: flex !important;
815
  align-items: center !important;
816
- justify-content: center !important;
817
- margin: 0 !important;
818
  }
819
 
820
- /* Style the button text */
821
- .file-upload-container label span {
 
822
  font-size: 14px !important;
823
  font-weight: normal !important;
824
- margin: 0 !important;
825
- display: inline-block !important;
826
- }
827
-
828
- /* Hover effect */
829
- .file-upload-container > div:last-child:hover {
830
- background-color: #e0e0e0 !important;
831
  }
832
 
833
- /* Hide any additional elements that might appear */
834
- .file-upload-container * {
835
- margin: 0 !important;
836
  }
837
 
838
- /* Hide the file selection area */
839
- .file-upload-container div[data-testid="block"] > div[data-testid="droparea"] {
840
- display: none !important;
841
  }
842
  """
843
 
@@ -869,10 +855,13 @@ def create_interface():
869
  )
870
 
871
  with gr.Column(elem_classes=["file-upload-container"], scale=0):
 
 
 
872
  file_upload = gr.File(
873
  file_types=["image", "pdf", "doc", "docx"],
874
  type="binary",
875
- label="Upload Document"
876
  )
877
 
878
  # Analyze button
 
780
  color: white !important;
781
  }
782
 
783
+ /* Style the file upload container */
784
  .file-upload-container {
785
  margin-left: 15px;
 
 
786
  display: inline-block;
787
+ vertical-align: top;
 
788
  }
789
 
790
+ /* Hide all elements except what we want */
791
  .file-upload-container .file-preview,
792
+ .file-upload-container p:not(.drop-text),
 
793
  .file-upload-container svg,
794
+ .file-upload-container label span {
 
795
  display: none !important;
796
  }
797
 
798
+ /* Style the drop area properly */
799
+ .file-upload-container [data-testid="chunkFileDropArea"] {
 
 
 
 
 
 
800
  background-color: #f0f0f0 !important;
801
  border: 1px solid #d9d9d9 !important;
802
  border-radius: 4px !important;
803
+ height: 42px !important; /* Slightly taller to align with radio buttons */
804
+ padding: 10px 15px !important;
805
  display: flex !important;
806
  align-items: center !important;
807
+ justify-content: flex-start !important;
808
+ width: 320px !important;
809
  }
810
 
811
+ /* Style the drop text */
812
+ .file-upload-container .drop-text {
813
+ margin: 0 !important;
814
  font-size: 14px !important;
815
  font-weight: normal !important;
816
+ color: #555 !important;
 
 
 
 
 
 
817
  }
818
 
819
+ /* Hide "or" text but keep "Drop File Here" */
820
+ .file-upload-container .drop-text + * {
821
+ display: none !important;
822
  }
823
 
824
+ /* Hover effect */
825
+ .file-upload-container [data-testid="chunkFileDropArea"]:hover {
826
+ background-color: #e0e0e0 !important;
827
  }
828
  """
829
 
 
855
  )
856
 
857
  with gr.Column(elem_classes=["file-upload-container"], scale=0):
858
+ # Add a special class to identify and style the drop text
859
+ gr.HTML("<p class='drop-text'>Drop File Here</p>", visible=False)
860
+
861
  file_upload = gr.File(
862
  file_types=["image", "pdf", "doc", "docx"],
863
  type="binary",
864
+ label=""
865
  )
866
 
867
  # Analyze button