This directory contains the Gradio demo for Loghi Software. It features a graphical user interface (GUI) to demonstrate the capabilities of Loghi tools including Loghi Tooling, Laypa, and Loghi-HTR.
Note
This is a demonstration setup and is not optimized for batch processing or high-workload production environments.
- Interactive GUI for process visualization and result inspection.
- Recommended Docker setup for ease of configuration.
Before you begin, ensure you have:
- Installed Docker: Required if you opt for the recommended Docker setup.
- Installed Python and pip: Necessary for running the demo using Python.
- Downloaded Laypa and HTR models
-
Build the Docker image using the following command:
docker build -t loghi-demo . -
Navigate to the
dockerdirectory:cd docker -
Configure the variables in the
.envfile to suit your setup:LAYPA_MODEL_PATH: Full path to your downloaded Laypa model directory (for example/home/downloads/laypa-models/baseline)LOGHI_BASE_MODEL_DIR: Note that unlike the previous variable, you need to split the full path to the HTR model into two parts. This one is the path to the directory containing HTR model(s) you downloaded (for example/home/downloads/loghi-models).LOGHI_MODEL_NAME: Name of the specific HTR model to use (the folder name insideLOGHI_BASE_MODEL_DIR)TOOLING_CONFIG_FILE: Full path tologhi/webservice/loghi-tooling/configuration.ymlin your cloned repositoryLAYPA_OUTPUT_PATH,LOGHI_OUTPUT_PATH, andTOOLING_OUTPUT_PATH: Change to where you want output files saved (directories must exist)
-
To run the demo, execute:
docker compose up
This starts all necessary services including the Gradio server.
-
Install the required Python dependencies:
pip install -r requirements.txt
-
Start each necessary service component:
Since the services cannot be started with a single command, you'll need to either:
- Start each Docker container individually, ensuring they run in webservice mode, or
- Navigate to each submodule repository and follow the specific instructions provided there to start each service.
-
To launch the Gradio demo interface:
./start_with_python.sh
After you've set up the demo using Docker or Python, here's how you can proceed with using it:
- Navigate to the Gradio web interface at
http://localhost:7860. - Upload a document image to start the processing.
- View the Laypa results to see the layout analysis.
- Check the HTR results for the extracted text.
- Download the PageXML output for detailed text annotations.
The following screenshots provide a visual overview of the Gradio interface and the workflow for the Loghi Software demo:
-
Start Screen with Uploaded Image: This is the initial screen where users can upload a document image to process. It’s the starting point of the demo where you begin your interaction with the Loghi tools.
-
Laypa Result: After processing, the demo shows the Laypa results, displaying the layout analysis of the uploaded document. It segments the document into lines, facilitating further processing.
-
HTR Result: The Handwritten Text Recognition (HTR) result screen showcases the extracted text from the document. This screen validates the accuracy and quality of the text recognition process.
-
PageXML Output: The demo allows users to download the PageXML file, which contains detailed annotations of the text and its structure as recognized by the tool. This file can be used for a variety of downstream tasks and applications.



