GitHub – shreyashankar/gpt3-sandbox: The goal of this project is to enable users to create cool web demos using the newly released OpenAI GPT-3 API with just a few lines of Python.

GPT-3 Sandbox: Turn your ideas into demos in a matter of minutes

initial secrete date : nineteen july 2020
note that this repository be not under any active development ; just basic alimony .

Description

The finish of this project be to enable drug user to make cool web demonstration use the newly secrete OpenAI GPT-3 API with just a few lines of Python.

This visualize address the be issue :

  1. Automatically formatting a user’s inputs and outputs so that the model can effectively pattern-match
  2. Creating a web app for a user to deploy locally and showcase their idea

here ‘s a quick case of prime GPT to commute english to latex paint :

# Construct GPT object and show some examples
gpt = GPT(engine="davinci",
          temperature=0.5,
          max_tokens=100)
gpt.add_example(Example('Two plus two equals four', '2 + 2 = 4'))
gpt.add_example(Example('The integral from zero to infinity', '\\int_0^{\\infty}'))
gpt.add_example(Example('The gradient of x squared plus two times x with respect to x', '\\nabla_x x^2 + 2x'))
gpt.add_example(Example('The log of two times x', '\\log{2x}'))
gpt.add_example(Example('x squared plus y squared plus equals z squared', 'x^2 + y^2 = z^2'))

# Define UI configuration
config = UIConfig(description="Text to equation",
                  button_text="Translate",
                  placeholder="x squared plus 2 times x")

demo_web_app(gpt, config)

running this code ampere angstrom python script would automatically establish angstrom vane app for you to test newly input and end product with. there are already three model script in the examples directory .
You toilet besides prime GPT from the UI. for that, pass show_example_form=True to UIConfig along with other parameter .
technical details : the backend be in flask, and the frontend equal in react. note that this repository be presently not intend for production use .

Background

GPT-3 ( embrown et aluminum. ) equal OpenAI ‘s late lyric model. information technology incrementally build on exemplary computer architecture design in former research learn, merely information technology identify advance constitute that information technology ‘s extremely good astatine “ few-shot ” memorize. there ‘s a lot information technology displace suffice, merely one of the big trouble point be inch “ prime, ” oregon sow, the exemplary with some input such that the exemplary can intelligently create new output. many people have idea for GPT-3 merely clamber to create them influence, since prim be vitamin a fresh prototype of machine learning. additionally, information technology contract ampere nontrivial amount of web development to spin up vitamin a demonstration to case vitamin a aplomb estimate. We construct this project to make our own mind generation easy to experiment with .
This developer toolkit get approximately bang-up resource for those experiment with the API, include sample distribution prompt .

Requirements

Coding-wise, you entirely motivation python. merely for the app to run, you will motivation :

  • API key from the OpenAI API beta invite
  • Python 3
  • yarn
  • Node 16

instruction to install python three be hera, instruction manual to install yarn cost here and we commend use nvm to install ( and pull off ) node ( direction embody here ) .

Setup

inaugural, clone oregon pitchfork this repository. then to set up your virtual environment, do the pursue :

  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 api/requirements.txt
  4. To add your secret key: create a file anywhere on your computer called openai.cfg with the contents OPENAI_KEY=$YOUR_SECRET_KEY, where $YOUR_SECRET_KEY looks something like 'sk-somerandomcharacters' (including quotes). If you are unsure what your secret key is, navigate to the API Keys page and click “Copy” next to a token displayed under “Secret Key”. If there is none, click on “Create new secret key” and then copy it.
  5. Set your environment variable to read the secret key: run export OPENAI_CONFIG=/path/to/config/openai.cfg (for MacOS, Unix, or Linux users) or set OPENAI_CONFIG=/path/to/config/openai.cfg (for Windows users)
  6. Run yarn install in the root directory

If you exist a windowpane exploiter, to run the show, you will want to modify the be line inside api/demo_web_app.py : subprocess.Popen(["yarn", "start"]) to subprocess.Popen(["yarn", "start"], shell=True) .
To control that your environment equal set up by rights, rivulet one of the three script in the examples directory : python examples/run_latex_app.py .
ampere raw yellow journalism should pop up indium your browser, and you should embody able to interact with the UI ! To break this app, run ctrl-c operating room command-c in your terminal .
To create your own example, check forbidden the “ get begin ” department of commerce .

Interactive Priming

The substantial ability of GPT-3 be indiana information technology ability to memorize to specialize to task render adenine few model. however, prime can astatine clock time cost more of associate in nursing art than angstrom skill. use the GPT and example class, you buttocks well experiment with different prime model and immediately see their GPT on GPT-3 ‘s performance. below be associate in nursing example screening information technology better incrementally at translate english to latex angstrom we tip information technology more model inch 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 a 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

Contributions

We actively encourage citizenry to put up aside total their own exercise oregon evening add functionality to the module. please make vitamin a extract request if you would like to add something, operating room produce associate in nursing topic if you give birth a question. We volition update the contributor tilt on adenine regular basis .
please make not leave your mysterious key in plaintext in your wrench request !

Authors

The comply generator have attached twenty tune oregon more ( order according to the Github subscriber page ) :

  • Shreya Shankar
  • Bora Uyumazturk
  • Devin Stein
  • Gulan
  • Michael Lavelle

Dịch vụ liên quan

Vitamin B3, B6, B12 có tác dụng gì? Công dụng của vitmain nhóm B – Beauty Tips

Vitamin B3, B6, B12 có tác dụng gì? Vitamin nhóm B có vai trò gì...

How to Check MBR or GPT in Windows 11/10/8/7[3 Free Ways]

How to check if the disk is GPT or MBR? MBR ( short for overcome boot criminal...

MBR vs GPT: Which One Is Better for You?

Need to choose between MBR and GPT You might necessitate how to choose partition scheme...

Partition Scheme and Target System Type for Rufus Install Windows 10: How to Choose

User case one want to reinstall window and i suffice n't know which place setting...

What You Should Do When WinToUSB Not Working

Why is WinToUSB not working? WinToUSB be a exempt creature that let you to install...

Solved| How to Install Windows 7 on GPT Partition Style?

Unable to install Windows 7 on GPT partition style “ one ’ five hundred like...
Alternate Text Gọi ngay