HUB
Sign inSign up
unstructured-api logo

longkeyy/unstructured-api

By longkeyy

•Updated over 1 year ago

Unstructured API Docker Image

Image
Machine learning & AI
Data science
0

1.6K

longkeyy/unstructured-api repository overview

⁠📄 Unstructured API Docker Image Guide

⁠Project Overview

Unstructured⁠ offers a powerful and flexible document preprocessing API that supports structured parsing of a wide variety of file formats, including PDFs, Word documents, images, emails, and more. You can choose from multiple processing strategies (hi_res, fast, ocr_only, and auto), with the new Chipper model (beta) offering enhanced accuracy for high-resolution and complex documents.

The API is suitable for use cases such as building knowledge bases, OCR pipelines, and structured data extraction.


⁠🚀 Quick Start

⁠Run with Docker
docker run -p 9001:9001 -d --rm --name unstructured-api \
  -e PORT=9001 \
  -e HF_ENDPOINT=https://hf-mirror.com \
  -e UNSTRUCTURED_PARALLEL_MODE_ENABLED=true \
  -e UNSTRUCTURED_PARALLEL_MODE_THREADS=32 \
  -e UNSTRUCTURED_PARALLEL_MODE_SPLIT_SIZE=32 \
  longkeyy/unstructured-api:latest
⁠Run with Docker Compose
version: '3'

services:
  unstructured-api:
    image: longkeyy/unstructured-api:latest
    ports:
      - "9001:9001"
    environment:
      - PORT=9001
      - HF_ENDPOINT=https://hf-mirror.com
      - UNSTRUCTURED_PARALLEL_MODE_ENABLED=true
      - UNSTRUCTURED_PARALLEL_MODE_THREADS=32
      - UNSTRUCTURED_PARALLEL_MODE_SPLIT_SIZE=32
    restart: unless-stopped

Start the service:

docker-compose up -d

The API will be available at http://localhost:9001.


⁠📦 Example Usage

⁠Basic API Call
curl -X 'POST' 'http://localhost:9001/general/v0/general' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'files=@sample-docs/family-day.eml' \
  | jq -C . | less -R
⁠Use hi_res + chipper Strategy
curl -X 'POST' 'http://localhost:9001/general/v0/general' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'files=@sample-docs/layout-parser-paper.pdf' \
  -F 'strategy=hi_res' \
  -F 'hi_res_model_name=chipper' \
  | jq -C . | less -R
⁠OCR with Multi-language Support
curl -X 'POST' 'http://localhost:9001/general/v0/general' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'files=@sample-docs/english-and-korean.png' \
  -F 'strategy=ocr_only' \
  -F 'languages=eng' \
  -F 'languages=kor' \
  | jq -C . | less -R
⁠Include Coordinates
curl -X 'POST' 'http://localhost:9001/general/v0/general' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'files=@sample-docs/layout-parser-paper.pdf' \
  -F 'coordinates=true' \
  | jq -C . | less -R
⁠Chunking by Title
curl -X 'POST' 'http://localhost:9001/general/v0/general' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F 'files=@sample-docs/layout-parser-paper-fast.pdf' \
  -F 'chunking_strategy=by_title' \
  | jq -C . | less -R

⁠🧠 Supported File Types

CategoryFile Types
Plaintext.txt, .eml, .msg, .xml, .html, .md, .rst, .json, .rtf
Images.jpeg, .png
Documents.doc, .docx, .ppt, .pptx, .pdf, .odt, .epub, .csv, .tsv, .xlsx
Compressed.gz

⁠🔧 Resources

Tag summary
Recent tags
Content type
Image
Digest
sha256:0b9565eb9…
Size
4.7 GB
Last updated
over 1 year ago
docker pull longkeyy/unstructured-api:latest