ApsidalSolid4 commited on
Commit
0177d87
·
verified ·
1 Parent(s): d771763

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -36
app.py CHANGED
@@ -780,46 +780,49 @@ def create_interface():
780
  color: white !important;
781
  }
782
 
783
- /* Styling for the file upload component to make it look like a button */
784
- .custom-file-upload {
785
  margin-left: 15px;
786
  }
787
 
788
- /* Hide file upload preview */
789
- .custom-file-upload .file-preview {
790
  display: none !important;
791
  }
792
 
793
- /* Remove the "or" text in the file upload component */
794
- .custom-file-upload .file-preview + p {
795
  display: none !important;
796
  }
797
 
798
- /* Style the file upload button to look like our desired Upload Document button */
799
- .custom-file-upload > div:last-child {
800
- height: 38px !important;
 
 
 
 
 
801
  padding: 0 15px !important;
802
  background-color: #f0f0f0 !important;
803
  border: 1px solid #d9d9d9 !important;
804
  border-radius: 4px !important;
805
- width: 100% !important;
 
 
806
  }
807
 
808
- /* Style the upload button text */
809
- .custom-file-upload label span {
810
  font-size: 14px !important;
811
  font-weight: normal !important;
 
812
  }
813
 
814
  /* Hover effect */
815
- .custom-file-upload > div:last-child:hover {
816
  background-color: #e0e0e0 !important;
817
  }
818
-
819
- /* Align the button container width with radio buttons */
820
- .button-container {
821
- width: 184px !important;
822
- }
823
  """
824
 
825
  with gr.Blocks(css=css, title="AI Text Detector") as demo:
@@ -840,26 +843,24 @@ def create_interface():
840
  gr.Markdown("Analysis Mode")
841
  gr.Markdown("Quick mode for faster analysis. Detailed mode for sentence-level analysis.")
842
 
 
843
  with gr.Row():
844
- # Column for radio buttons
845
- with gr.Column(scale=0):
846
- # Radio buttons for analysis mode
847
- mode_selection = gr.Radio(
848
- choices=["quick", "detailed"],
849
- value="quick",
850
- label="",
851
- show_label=False
852
- )
853
 
854
- # Column for upload button with fixed width to match radio buttons
855
- with gr.Column(elem_classes=["button-container"], scale=0):
856
- # Custom styled file upload component
857
- with gr.Column(elem_classes=["custom-file-upload"], scale=0):
858
- file_upload = gr.File(
859
- file_types=["image", "pdf", "doc", "docx"],
860
- type="binary",
861
- label="Upload Document"
862
- )
863
 
864
  # Analyze button
865
  analyze_btn = gr.Button("Analyze Text", elem_id="analyze-btn")
 
780
  color: white !important;
781
  }
782
 
783
+ /* Styling for file upload button */
784
+ .file-uploader {
785
  margin-left: 15px;
786
  }
787
 
788
+ /* Hide the standard file upload appearance */
789
+ .file-uploader .file-preview {
790
  display: none !important;
791
  }
792
 
793
+ /* Hide the drop area text */
794
+ .file-uploader .file-drop {
795
  display: none !important;
796
  }
797
 
798
+ /* Hide the "or" text */
799
+ .file-uploader p {
800
+ display: none !important;
801
+ }
802
+
803
+ /* Style the actual button */
804
+ .file-uploader > div:last-child {
805
+ height: 40px !important;
806
  padding: 0 15px !important;
807
  background-color: #f0f0f0 !important;
808
  border: 1px solid #d9d9d9 !important;
809
  border-radius: 4px !important;
810
+ display: flex !important;
811
+ align-items: center !important;
812
+ justify-content: center !important;
813
  }
814
 
815
+ /* Style the button text */
816
+ .file-uploader label span {
817
  font-size: 14px !important;
818
  font-weight: normal !important;
819
+ margin: 0 !important;
820
  }
821
 
822
  /* Hover effect */
823
+ .file-uploader > div:last-child:hover {
824
  background-color: #e0e0e0 !important;
825
  }
 
 
 
 
 
826
  """
827
 
828
  with gr.Blocks(css=css, title="AI Text Detector") as demo:
 
843
  gr.Markdown("Analysis Mode")
844
  gr.Markdown("Quick mode for faster analysis. Detailed mode for sentence-level analysis.")
845
 
846
+ # Create a row for radio buttons and upload button
847
  with gr.Row():
848
+ # Radio buttons for analysis mode
849
+ mode_selection = gr.Radio(
850
+ choices=["quick", "detailed"],
851
+ value="quick",
852
+ label="",
853
+ show_label=False
854
+ )
 
 
855
 
856
+ # File upload component
857
+ file_upload = gr.File(
858
+ file_types=["image", "pdf", "doc", "docx"],
859
+ type="binary",
860
+ label="Upload Document",
861
+ elem_classes=["file-uploader"],
862
+ interactive=True
863
+ )
 
864
 
865
  # Analyze button
866
  analyze_btn = gr.Button("Analyze Text", elem_id="analyze-btn")