Giter Club home page Giter Club logo

objection_engine's Introduction

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

  • Python 3 with pip
  • FFMPEG instalation. In most Linux distros it should be available in the default package manager. In Windows systems it'd include downloading a pre-compiled zip folder, extracting it and adding the /bin folder into the system path

Optional

  • Google Translation API Credentials: These are needed for language support other than English. Other languages may work even without this credentials as the system will fallback to TextBlob's translation system.
  • Libraqm: Improves text rendering on right-to-left languages. In windows refer to the faq.md

Installing

Clone the repository

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

Install dependencies (in case any problems are encountered please check faq.md)

python -m pip install -r requirements.txt

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

pip install pyICU pycld2 morfessor polyglot
python -m polyglot download TASK:sentiment2

Check the exmaple python example.py

Using it as a library

  • Add it as a library with git submodule add https://github.com/LuisMayo/objection_engine.git

  • Import it into your python file

import sys
sys.path.append('objection_engine/')
import objection_engine
# You can also import the components like this
from objection_engine.renderer import render_comment_list
from objection_engine.beans.comment import Comment
  • Create a list of comments
foo = [objection_engine.comment.Comment(), objection_engine.comment.Comment(text_content='Second comment',  user_name="Second user")]
  • Render the list
objection_engine.renderer.render_comment_list(foo)

For a list of arguments to the class and method check both https://github.com/LuisMayo/objection_engine/blob/main/renderer.py and https://github.com/LuisMayo/objection_engine/blob/main/beans/comment.py

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:

  • oe_bypass_sentiment: If on any value other than the empty string, the sentiment analysis is bypassed
  • oe_polyglot_models: (docker only) If on polyglot model(s), the data for the model will be downloaded when starting the container.

Contributing

Since this is a tiny project we don't have strict rules about contributions. Just open a Pull Request to fix any of the project issues or any improvement you have percieved on your own. Any contributions which improve or fix the project will be accepted as long as they don't deviate too much from the project objectives. If you have doubts about whether the PR would be accepted or not you can open an issue before coding to ask for my opinion.

objection_engine's People

Contributors

luismayo avatar micah5 avatar robimez avatar lens0021 avatar alex-unofficial avatar gadhagod avatar ericljiang avatar luludotdev avatar lunalunaa avatar l1n avatar jonatep avatar wanghaisheng avatar

Watchers

James Cloos 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.