No Description

sun-pc 2def99d234 update 3 weeks ago
static 6cfa33fb74 update 3 weeks ago
.env 5e75f2204a update 3 weeks ago
Dockerfile 99b5701e8a update 3 weeks ago
build.sh 010ce028b1 update 3 weeks ago
main.py 2def99d234 update 3 weeks ago
readme.md 50b487550f init 3 weeks ago
requirements.txt 50b487550f init 3 weeks ago

readme.md

docker build -t your-image-name:tag .

EPS to SVG Converter Service

A Docker-based web service that converts EPS files to optimized SVG files and uploads them to Huawei Cloud OBS.

Features

  • HTTP endpoint for uploading EPS files (max 10MB)
  • Converts EPS to SVG using eps2svg
  • Optimizes SVG using scour
  • Uploads processed files to Huawei Cloud OBS
  • Includes health check endpoint

Prerequisites

  • Docker
  • Huawei Cloud OBS account credentials

Setup

  1. Copy .env.example to .env and fill in your OBS credentials:

    cp .env.example .env
    
  2. Edit .env with your Huawei Cloud OBS credentials:

    OBS_ACCESS_KEY=your_access_key
    OBS_SECRET_KEY=your_secret_key
    OBS_ENDPOINT=your_obs_endpoint
    OBS_BUCKET=your_bucket_name
    
  3. Build the Docker image:

    docker build -t eps2svg .
    
  4. Run the container:

    docker run -p 8000:8000 --env-file .env eps2svg
    

API Endpoints

POST /convert

Converts an EPS file to SVG and uploads it to OBS.

  • Method: POST
  • Content-Type: multipart/form-data
  • Max file size: 10MB
  • Accepts: .eps files only

Example response:

{
    "status": "success",
    "message": "File processed successfully",
    "obs_key": "svg/filename.svg"
}

GET /health

Health check endpoint.

Response:

{
    "status": "healthy"
}

Error Handling

The service returns appropriate HTTP status codes and error messages:

  • 400: Invalid file type or file too large
  • 500: Processing or upload errors

Implementation Details

  1. File Upload: Accepts EPS files through HTTP endpoint
  2. Processing:
    • eps2svg converts EPS to SVG
    • scour optimizes the SVG output
  3. Storage: Processed files are uploaded to Huawei Cloud OBS
  4. Cleanup: Temporary files are removed after processing