Git Product home page Git Product logo

django-local-ai's Introduction

Django local AI

Run a local AI from Django with Llama.cpp

Install

Clone the repository and install the dependencies:

git clone https://github.com/emencia/django-local-ai
cd django-local-ai
make install

In case of an error Failed to build llama-cpp-python try this and run again:

source .venv/bin/activate
export SETUPTOOLS_USE_DISTUTILS=stdlib
pip install --upgrade --force-reinstall setuptools

Get the websockets server:

make installws

Get a language model

To make this work you need a Llama.cpp ggml compatible language model. For example we will use GPT4All-13B-snoozy from this repository:

cd some/dir/where/to/put/your/models
wget https://huggingface.co/TheBloke/GPT4All-13B-snoozy-GGML/resolve/main/GPT4All-13B-snoozy.ggmlv3.q5_0.bin

Change your settings accordingly by updating the MODEL_PATH setting in main/settings.py. Use an absolute path.

Make and check the right settings

First, append this to your Django settings (./main/settings.py):

CENTRIFUGO_HOST = "http://localhost"
CENTRIFUGO_PORT = 8427
CENTRIFUGO_HMAC_KEY = "b4265250-3672-4ed9-abe5-b17ca67d0104"
CENTRIFUGO_API_KEY = "21dae466-e63e-41d1-8f75-3aa94b41c893"
SITE_NAME = "django-local-ai"

and don't forget to finish the setup:

.venv/bin/python manage.py initws --settings=main.settings.local

Now, you're ready to enjoy your local LLM !

Run

Run the http server:

make run

Run the task queue that will handle language model calls:

make lm

Run the websockets server:

make ws

Create a superuser:

make superuser

Open the frontend at localhost:8000 and login

django-local-ai's People

Contributors

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