Coder Social home page Coder Social logo

jc92 / baby-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from itspreto/baby-code

0.0 0.0 0.0 1.12 MB

Baby ๐Ÿฆ™ Code ๐Ÿ Interpreter

Home Page: https://github.com/itsPreto/baby-interpreter

Python 21.37% CSS 19.37% HTML 59.26%

baby-code's Introduction

๐Ÿฆ™ Baby Code Interpreter

An open-source, locally-run, python code interpreter (like openAI's GPT-4 Plugin: Code-Interpreter).

Baby Code is:

  • primarily and mostly for fun, as it is extremely early in development.
  • extremly SIMPLE,
  • 100% LOCAL &
  • CROSS-PLATFORM.

Screenshot 2023-07-26 at 1 41 33 PM

It leverages open source LLMs to interpret user's requests into Python code. The service is exposed through a Flask server which receives user's requests, processes them, and returns Python code.

๐Ÿ—๏ธ Architecture (in a nutshell)

  • ๐Ÿ–ฅ๏ธ Backend: Python Flask (CORS for serving both the API and the HTML).
  • ๐ŸŒ Frontend: HTML/JS/CSS (The UI was designed 100% to personal liking but open for changes).
  • โš™๏ธ Engine: Llama.cpp (Inference library for Llama/GGML models).
  • ๐Ÿง  Model: Llama-2 (Only models compatible with Llama.cpp).
  • โš–๏ธ Arbiter: LangChain (Gluing all these components together).
  • ๐ŸŽ Wrapper: LlamaCpp (LangChain's wrapper around Llama.cpp for loading the models).

๐Ÿš€ Setup

  • Clone the repo:
git clone https://github.com/itsPreto/baby-interpreter
  • Navigate to the project:
cd baby-interpreter
  • Install the following libraries (requirements.txt coming soon...):
pip install flask flask_cors subprocess langchain

๐Ÿง  Model Config

This project is configured to use LlamaCpp and load up models for local inference. Models can be found on HuggingFace and once downloaded you can simply place them in the \models folder and update the MODEL path variable in main.py.

WIZARD_LM_V2 = "WizardLM-13B-V1.2/WizardLM-13B-V1.2-GGML-q4_0.bin"
USEFUL_CODER = "useful_coder/code-cherryLamma-2/useful-coder-ggml-q4_0.bin"
MODEL = f"./models/{USEFUL_CODER}"

๐Ÿƒโ€โ™€๏ธ Run it

  • Simply execute:
python main.py 

The Flask server will start and listen on port 8000. The server exposes two endpoints /generate and /run.

๐ŸŒ Endpoints

  • /generate: receives a POST request with a user's question in the body. The question is processed by the LLM, and a Python code snippet is generated and returned.

  • /run: receives a POST request with Python code in the body. The code is executed, and the output of the execution is returned.

๐Ÿค Contributing

Contributions to this project are welcome. Please create a fork of the repository, make your changes, and submit a pull request. I'll be creating a few issues for feature tracking soon!!

ALSO~~~ If anyone would like to start a Discord channel and help me manage it that would be awesome (I'm not on it that much).

License

This project is licensed under the MIT License.

baby-code's People

Contributors

itspreto 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.