Coder Social home page Coder Social logo

pdf_translator's Introduction

PDF Translator

This repository offers an WebUI and API endpoint that translates PDF files using openai GPT, preserving the original layout.

Features

  • translate PDF files while preserving layout

  • translation engines:

    • google translate (default)
    • openAI (best)
  • layout recognition engines:

    • UniLM DiT
  • OCR engines:

    • PaddleOCR
  • Font recognition engines:

    • /

Installation

  1. Clone this repository
   git clone https://github.com/ppisljar/pdf_translator.git
   cd pdf_translator
  1. Edit config.yaml and enter openai api key change type to 'openai' and enter your key under openai_api_key if this is not changed translation engine will default to google translate

docker installation

  1. Build the docker image via Makefile
   make build
  1. Run the docker container via Makefile
   make run

venv installation

  1. create venv and activte

prerequesites:

  • ffmpeg, ... possibly more, check Dockerfile if you are running into issues
python3 -m venv .
source bin/activate
  1. install requirements
pip3 install -r requirements.txt
pip3 install "git+https://github.com/facebookresearch/detectron2.git"
  1. get models
make get_models
  1. run
python3 server.py

GUI Usage

Access to GUI via browser.

http://localhost:8765

Requirements

  • NVIDIA GPU (currently only support NVIDIA GPU)
  • Docker

License

This repository does not allow commercial use.

This repository is licensed under CC BY-NC 4.0. See LICENSE for more information.

TODOs

  • Make possible to highlight the translated text
  • Support M1 Mac or CPU
  • switch to VGT for layout detection
  • add font detection (family/style/color/size/alignment)
  • add support for translating lists
  • add support for translating tables
  • add support for translating text within images

References

pdf_translator's People

Contributors

discus0434 avatar ppisljar avatar stn avatar derad6709 avatar dunky-z avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.