Giter Club home page Giter Club logo

magnum's Introduction

MAGNUM (AI Math Animator powered by GPT-3 and Wolfram Alpha)

All Contributors

Visualize Beautiful Math solutions

Manim Logo

Initial release date: 15 August 2020

Fork Credits: The gpt3-sandbox project was taken as the starting point for this project. We would like to thank the authors of GPT-3-Sandbox for all their help. :)

Description

The goal of this project is to create an Open Source toolkit that makes Math animations effortless. Either from a plain English query or from formatted LaTeX! NO PYTHON CODING NEEDED.

This project addresses the following issues:

  1. Create an end to end package using Wolfram Alpha and GPT-3 to visualize Step-by-step Math soultions to user questions.
  2. Create a standalone package which enables you to convert LaTeX into beautiful animations without any knowledge of Manim.

For full docs and detailed information, have a look at our website: https://magnum.shreenabh.com/ .

Magnum Lite

Before we get to Setting up, we would like to point out that we have made a special NO-CODE + BROWSER-BASED (Cloud hosted) Playground for Magnum Lite (!). If you are not much into software and code, this might be a nice option for you. Have a look at the detailed comparison here.

Setup

First, clone or fork this repository. Then to set up your virtual environment, do the following:

  1. Create a virtual environment in the root directory: python -m venv $ENV_NAME
  2. Activate the virtual environment: source $ENV_NAME/bin/activate (for MacOS, Unix, or Linux users) or .\ENV_NAME\Scripts\activate (for Windows users)
  3. Install requirements: pip install -r requirements.txt
  4. To add your OpenAI Secret Key: Open the file called openai in the api_keys folder and add your Seceret Key there $YOUR_SECRET_KEY, where $YOUR_SECRET_KEY looks something like 'sk-somerandomcharacters' (excluding quotes). If you are unsure what your secret key is, navigate to the API docs and copy the token displayed next to the "secret" key type.
  5. To add your Wolfram Alpha AppID: open the file called appid int the api_keys folder and add your AppID there $YOUR_SECRET_KEY, where $YOUR_SECRET_KEY looks something like 'ZHR$%D-GET$%ASBF$' (excluding quotes).

(For detailed Setup information for the no code playground, check our website)

Interactive Priming

The real power of GPT-3 is in its ability to learn to specialize to tasks given a few examples. However, priming can at times be more of an art than a science. Using the GPT and Example classes, you can easily experiment with different priming examples and immediately see their GPT on GPT-3's performance. Below is an example showing it improve incrementally at translating English to LaTeX as we feed it more examples in the python interpreter:

>>> from api import GPT, Example, set_openai_key
>>> gpt = GPT()
>>> set_openai_key(key)
>>> prompt = "integral from a to b of f of x"
>>> print(gpt.get_top_reply(prompt))
output: integral from at to be of f of x

>>> gpt.add_example(Example("Two plus two equals four", "2 + 2 = 4"))
>>> print(gpt.get_top_reply(prompt))
output:

>>> gpt.add_example(Example('The integral from zero to infinity', '\\int_0^{\\infty}'))
>>> print(gpt.get_top_reply(prompt))
output: \int_a^b f(x) dx

Using Custom Priming Data

We have provided you with the basic priming data for the text to Manim GPT-3 model. The LaTeX conversion is slightly non standard as the text is interperetd in TeX so to introduct spacing we have to insert a " / ". Another way of doing this is by explicitly declaring text as \text{Your Text Here}.

If you wish to provide your own examples for priming you can edit the files in the "Training_Examples" directory.

A note if you are using Non-Standard LaTeX packages

We use Manim to animate the solution from Wolfram. Follow the instructions at manim github page to get Manim up and running.

If your LaTeX code uses non-standard or additional packages you will need the manim source code and NOT the "pip" version .

Again the instructions to install the required version are given on Manim github page or you can follow the Manim docs here

For non standard LaTeX packages, follow this amazing video

Rendering options for manim

Manim provides you with a full array of rendering options from setting aspect ratios to resoultion and framerate.

Follow the video here to get insight on all the options

Contributions

We actively encourage people to contribute by adding their own examples or even adding functionalities to the modules. Please make a pull request if you would like to add something, or create an issue if you have a question. We will update the contributors list on a regular basis.

Please do not leave your secret key and/or AppID in plaintext in your pull request!

Contributors โœจ

Thanks goes to these wonderful people (emoji key):


Shreenabh Agrawal

๐Ÿ› ๐Ÿ’ป ๐Ÿ–‹ ๐Ÿ“– ๐ŸŽจ ๐Ÿ“† โš ๏ธ

Mayur Selukar

๐Ÿ’ป ๐Ÿ› ๐Ÿ“– ๐ŸŽจ โš ๏ธ

Nanu

๐Ÿ’ป ๐Ÿ› โš ๏ธ

Kartik Kinge

๐Ÿค”

This project follows the all-contributors specification. Contributions of any kind welcome!

magnum's People

Contributors

allcontributors[bot] avatar mrselukar avatar nanu00 avatar shreenabh664 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.