Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -174,7 +174,11 @@ def htr_text( | |
| 174 | 
             
                document_type: FormatChoices = "letter_swedish",
         | 
| 175 | 
             
                custom_settings: Optional[str] = None,
         | 
| 176 | 
             
            ) -> str:
         | 
| 177 | 
            -
                """Extract text from handwritten documents using HTR. | 
|  | |
|  | |
|  | |
|  | |
| 178 | 
             
                try:
         | 
| 179 | 
             
                    processed_collection = _process_htr_pipeline(
         | 
| 180 | 
             
                        image_path, document_type, custom_settings
         | 
| @@ -293,6 +297,11 @@ def create_htrflow_mcp_server(): | |
| 293 | 
             
                    inputs=[
         | 
| 294 | 
             
                        gr.Image(type="filepath", label="Upload Original Image"),
         | 
| 295 | 
             
                        gr.File(label="Upload ALTO/PAGE XML File"),
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 296 | 
             
                    ],
         | 
| 297 | 
             
                    outputs=gr.File(label="Download Visualization Image"),
         | 
| 298 | 
             
                    description="Visualize HTR results by overlaying text regions and polygons on the original image",
         | 
| @@ -310,4 +319,4 @@ def create_htrflow_mcp_server(): | |
| 310 |  | 
| 311 | 
             
            if __name__ == "__main__":
         | 
| 312 | 
             
                demo = create_htrflow_mcp_server()
         | 
| 313 | 
            -
                demo.launch(mcp_server=True, share=False, debug=False)
         | 
|  | |
| 174 | 
             
                document_type: FormatChoices = "letter_swedish",
         | 
| 175 | 
             
                custom_settings: Optional[str] = None,
         | 
| 176 | 
             
            ) -> str:
         | 
| 177 | 
            +
                """Extract text from handwritten documents using HTR.
         | 
| 178 | 
            +
             | 
| 179 | 
            +
                returns:
         | 
| 180 | 
            +
                    str: Extracted text from the image.
         | 
| 181 | 
            +
                """
         | 
| 182 | 
             
                try:
         | 
| 183 | 
             
                    processed_collection = _process_htr_pipeline(
         | 
| 184 | 
             
                        image_path, document_type, custom_settings
         | 
|  | |
| 297 | 
             
                    inputs=[
         | 
| 298 | 
             
                        gr.Image(type="filepath", label="Upload Original Image"),
         | 
| 299 | 
             
                        gr.File(label="Upload ALTO/PAGE XML File"),
         | 
| 300 | 
            +
                        gr.Textbox(
         | 
| 301 | 
            +
                            label="Server Name",
         | 
| 302 | 
            +
                            value="https://gabriel-htrflow-mcp.hf.space",
         | 
| 303 | 
            +
                            placeholder="Server URL for download links",
         | 
| 304 | 
            +
                        ),
         | 
| 305 | 
             
                    ],
         | 
| 306 | 
             
                    outputs=gr.File(label="Download Visualization Image"),
         | 
| 307 | 
             
                    description="Visualize HTR results by overlaying text regions and polygons on the original image",
         | 
|  | |
| 319 |  | 
| 320 | 
             
            if __name__ == "__main__":
         | 
| 321 | 
             
                demo = create_htrflow_mcp_server()
         | 
| 322 | 
            +
                demo.launch(mcp_server=True, share=False, debug=False)
         | 
