OCR and Markdown Conversion API

A simple web interface for testing the OCR and Markdown Conversion API.

Table of Contents

Quick Start

  1. Clone this repository
  2. Run docker-compose up -d
  3. Open your browser and navigate to http://localhost:9000

API Overview

The OCR and Markdown Conversion API allows you to convert image files and documents into Markdown format. It provides the following endpoints:

API Endpoints

Upload Files

Upload one or more files to be processed by the OCR engine.

Endpoint: POST /upload/

Parameters:

Response:

{
  "total_processing_time_seconds": 1.39,
  "results": [
    {
      "file_name": "text-image-title.png",
      "page_count": 1,
      "processing_time_seconds": 1.39,
      "status": "Success",
      "content_preview": "# Page 1\n\n```\nHOW TO COMBINE\nTEXT AND IMAGE\nIN ELEARNING DESIGN\n\n```\n\n-----\n\n---",
      "markdown_content": "# Page 1\n\n```\nHOW TO COMBINE\nTEXT AND IMAGE\nIN ELEARNING DESIGN\n\n```\n\n-----\n\n---",
      "ocr_pdf_id": null,
      "markdown_id": "7f8f10c8-d51b-4773-9db8-5e748f12aa3d",
      "file_id": "413a9347-79ce-434e-bfac-27eab54db928"
    }
  ]
}

Check Progress

Check the processing status of an uploaded file.

Endpoint: GET /progress/{file_id}

Parameters:

Response:

A string containing the progress information.

Download Markdown

Download the converted Markdown file.

Endpoint: GET /download-markdown/{md_id}

Parameters:

Response:

A string containing the Markdown content.

Cleanup File

Remove a stored file from the server.

Endpoint: DELETE /cleanup/{file_id}

Parameters:

Response:

A string confirming the cleanup operation.

Health Check

Check the health status of the API.

Endpoint: GET /health

Response:

A string containing the health status information.

How to Use

  1. Upload Files:
  2. Check Progress:
  3. Download Markdown:
  4. Cleanup Files:
  5. Health Check:

Understanding the Response

When you upload a file, the API returns a JSON response with the following information:

Configuration

The API URL is set to http://192.168.1.151:8000 by default. You can change this by clicking the "Change" button next to the API URL at the top of the interface.

Troubleshooting

Docker Setup

This interface is containerized using Docker. To run it:

  1. Make sure Docker and Docker Compose are installed
  2. Run docker-compose up -d in the directory containing the docker-compose.yml file
  3. Access the interface at http://localhost:9000

To stop the container, run docker-compose down.