@@ -558,34 +558,8 @@ def convert_to_html(
558558 return error_msg , "" , None
559559
560560
561- # Create the Gradio interface with modern Gradio 5 styling
562- with gr .Blocks (
563- title = "PDF Document Layout Analysis" ,
564- theme = gr .themes .Soft (
565- primary_hue = "blue" ,
566- secondary_hue = "slate" ,
567- font = gr .themes .GoogleFont ("Inter" ),
568- ),
569- css = """
570- .gradio-container {
571- max-width: 1400px !important;
572- margin: 0 auto !important;
573- padding: 20px !important;
574- }
575- .output-text {
576- font-family: 'Monaco', 'Courier New', monospace;
577- }
578- footer {
579- display: none !important;
580- }
581- /* Center the main content */
582- body {
583- display: flex;
584- justify-content: center;
585- }
586- """ ,
587- analytics_enabled = False ,
588- ) as app :
561+ # Create the Gradio interface with modern Gradio 6 styling
562+ with gr .Blocks (title = "PDF Document Layout Analysis" ) as app :
589563 gr .Markdown (
590564 f"""
591565 # 📄 PDF Document Layout Analysis Tool
@@ -645,7 +619,7 @@ def convert_to_html(
645619 with gr .Column (scale = 2 ):
646620 analyze_summary = gr .Textbox (label = "Summary" , lines = 8 )
647621 analyze_details = gr .Textbox (
648- label = "Detailed Results (JSON)" , lines = 15 , elem_classes = "output-text" , show_copy_button = True
622+ label = "Detailed Results (JSON)" , lines = 15 , elem_classes = "output-text" , buttons = [ "copy" ]
649623 )
650624
651625 analyze_btn .click (
@@ -685,9 +659,7 @@ def convert_to_html(
685659
686660 with gr .Column (scale = 2 ):
687661 text_summary = gr .Textbox (label = "Summary" , lines = 3 )
688- text_output = gr .Textbox (
689- label = "Extracted Text" , lines = 20 , elem_classes = "output-text" , show_copy_button = True
690- )
662+ text_output = gr .Textbox (label = "Extracted Text" , lines = 20 , elem_classes = "output-text" , buttons = ["copy" ])
691663
692664 # Store all checkboxes in a list for easier management
693665 type_checkboxes = [
@@ -726,7 +698,7 @@ def convert_to_html(
726698 with gr .Column (scale = 2 ):
727699 toc_summary = gr .Textbox (label = "Summary" , lines = 3 )
728700 toc_output = gr .Textbox (
729- label = "Table of Contents" , lines = 20 , elem_classes = "output-text" , show_copy_button = True
701+ label = "Table of Contents" , lines = 20 , elem_classes = "output-text" , buttons = [ "copy" ]
730702 )
731703
732704 toc_btn .click (fn = extract_toc , inputs = [pdf_input_toc , fast_mode_toc ], outputs = [toc_summary , toc_output ])
@@ -828,7 +800,7 @@ def convert_to_html(
828800 with gr .Column (scale = 2 ):
829801 md_summary = gr .Textbox (label = "Summary" , lines = 2 )
830802 md_content = gr .Textbox (
831- label = "Markdown Output (Base Language)" , lines = 20 , elem_classes = "output-text" , show_copy_button = True
803+ label = "Markdown Output (Base Language)" , lines = 20 , elem_classes = "output-text" , buttons = [ "copy" ]
832804 )
833805 md_output = gr .File (label = "Download ZIP (contains Markdown + images + segmentation)" )
834806
@@ -902,7 +874,7 @@ def convert_to_html(
902874 with gr .Column (scale = 2 ):
903875 html_summary = gr .Textbox (label = "Summary" , lines = 2 )
904876 html_content = gr .Textbox (
905- label = "HTML Output (Base Language)" , lines = 20 , elem_classes = "output-text" , show_copy_button = True
877+ label = "HTML Output (Base Language)" , lines = 20 , elem_classes = "output-text" , buttons = [ "copy" ]
906878 )
907879 html_output = gr .File (label = "Download ZIP (contains HTML + images + segmentation)" )
908880
@@ -939,4 +911,33 @@ def convert_to_html(
939911 print ("⚠️ Starting UI anyway, but backend may not be available." , flush = True )
940912 print (" Please check that the API service is running.\n " , flush = True )
941913
942- app .launch (server_name = "0.0.0.0" , server_port = 7860 , share = False , show_error = True , max_file_size = "100mb" )
914+ app .launch (
915+ server_name = "0.0.0.0" ,
916+ server_port = 7860 ,
917+ share = False ,
918+ show_error = True ,
919+ max_file_size = "100mb" ,
920+ theme = gr .themes .Soft (
921+ primary_hue = "blue" ,
922+ secondary_hue = "slate" ,
923+ font = gr .themes .GoogleFont ("Inter" ),
924+ ),
925+ css = """
926+ .gradio-container {
927+ max-width: 1400px !important;
928+ margin: 0 auto !important;
929+ padding: 20px !important;
930+ }
931+ .output-text {
932+ font-family: 'Monaco', 'Courier New', monospace;
933+ }
934+ footer {
935+ display: none !important;
936+ }
937+ /* Center the main content */
938+ body {
939+ display: flex;
940+ justify-content: center;
941+ }
942+ """ ,
943+ )
0 commit comments