Deploying with Docker
This document provides instructions for building a self-contained Docker image for Youtu Parsing that includes all model weights and dependencies.
Requirements:
- Docker installed on your system
- Sufficient disk space (~15GB for the image)
- NVIDIA GPU with CUDA 12.x support (required for running the container)
Setting Up the Build Directory
First, create a directory for building the Docker image and download the model weights:
Creating the Parsing Server Script
Create a file named youtu_parsing_server.py with the server implementation. You can copy this from the local deployment guide or create it with the following content:
Creating the Dockerfile
Create a file named Dockerfile with the following content:
Building the Docker Image
Build the Docker image with the following command:
This process may take several minutes as it downloads the base image, installs dependencies (including Flash Attention), and copies the model weights.
Running the Docker Container
Run the container with GPU support:
You can customize the server parameters:
To disable angle correction:
Pushing to a Container Registry
To deploy on a remote machine, push the image to a container registry:
Running on a Remote Machine
On the remote machine, pull and run the image:
The Youtu Parsing service will be available at http://<remote-machine-ip>:8501.
API Endpoints
Once running, the following endpoints are available:
| Endpoint | Method | Description |
|---|---|---|
/parse or / | POST | Parse a base64-encoded image |
/health | GET | Health check endpoint |
Example Usage
To parse an image, send a POST request with a base64-encoded image:
Final Directory Structure
Before building, your youtu-parsing-docker directory should have the following structure:
