LuisMayo / objection_engine

Library that turns comment chains into ace attorney scenes, used in several bots
MIT License
107 stars 20 forks source link
bot hacktoberfest python

Objection! rendering engine 👨🏼‍⚖️

Code that allows you to convert chains of comments into ace attorney scenes. It's meant to be used by bots or other apps. List of users:

This is a fork of a wonderful Reddit bot

Getting Started

Prerequisites

Optional

Installing

Clone the repository

git clone https://github.com/LuisMayo/objection_engine

Install dependencies (in case any problems are encountered please check faq.md) You can use either pip

python -m pip install .

Or poetry

poetry install

(optional) In case you want language support outside English install polyglot and its dependencies: (if on windows check faq.md)

python3 -m pip install pyICU pycld2 morfessor polyglot

Check the exmaple python example.py

Using it as a library

There is a complete example in https://github.com/LuisMayo/objection-engine-testing

Rendering a video using Docker

cp example.py docker-entrypoint.py

docker build --tag objection-engine .
docker run --rm \
  --volume $(pwd)/docker-entrypoint.py:/app/entrypoint.py:ro \
  --volume $(pwd)/assets:/app/assets \
  --volume $(pwd)/outputs:/app/outputs \
  objection-engine

The video will be in the /outputs directory.

You can download Polyglot models by setting oe_polyglot_models environment variable and preserve the data by mounting /root/polyglot_data:

docker run --rm \
  --volume $(pwd)/docker-entrypoint.py:/app/entrypoint.py:ro \
  --volume $(pwd)/assets:/app/assets \
  --volume $(pwd)/outputs:/app/outputs \
  --volume $(pwd)/polyglot_data:/root/polyglot_data \
  --env oe_polyglot_models="de fr" \
  objection-engine

Settings

The following environment variables are honored by objection_engine: