VOOZH about

URL: https://towardsdatascience.com/how-to-easily-set-up-a-neat-user-interface-for-your-local-llm-1a972da2310e/

โ‡ฑ How to Easily Set Up a Neat User Interface for Your Local LLM | Towards Data Science


Skip to content

How to Easily Set Up a Neat User Interface for Your Local LLM

A step-by-step guide to run Llama3 locally with Open WebUI

5 min read

๐Ÿ‘ Image generated by AI (Midjourney) by Author
Image generated by AI (Midjourney) by Author

1 Why Local LLMs

Whether itโ€™s due to company restrictions or a desire to handle personal data securely, many have avoided using ChatGPT due to data privacy concerns.

Fortunately, there are solutions that allow unlimited use of LLMs without sending sensitive data to the cloud.

In my previous article, I explored one such solution by explaining how to run Llama 3 locally thanks to Ollama.

Running Local LLMs is More Useful and Easier Than You Think

PREREQUISITE: by the end of that last article we had Llama 3 running locally thanks to Ollama and we could use it either through the terminal or within a Jupyter Notebook.

In this article I explain how to make the use of local LLMs more user-friendly through a neat UI in a matter of minutes!

So this article really is a follow-up where I explain step by step how to run a local LLM through a ChatGPT like user interface โ€“ Open WebUI. Spoiler alert: itโ€™s surprisingly simple!

Letโ€™s get started!


2 Brief Overview of Open WebUI

Open WebUI is an open-source interface for running AI models locally. It allows to chat with your LLM as you would with ChatGPT, through your web browser.

It is compatible with various different LLMs and has a very active community which ensures that the solution stays up to date with the latest models.

The interface is very clean and user-friendly which makes it super intuitive to use. Thereโ€™s even the possibility to switch between local models and fine-tune their hyper-parameters.

๐Ÿ‘ Open WebUI quick demo from https://github.com/open-webui/open-webui (MIT License)
Open WebUI quick demo from https://github.com/open-webui/open-webui (MIT License)

Promising!


3 Installing Docker

Well, we did talk about Open WebUI, so what is Docker doing here?

Docker allows you to easily run applications in isolated "containers" on your local computer. This simplifies software installation and ensures consistent, reliable execution across different environments. In other words, it is what we need to run Open WebUI.

To download Docker, just go to docker.com and click download:

๐Ÿ‘ Docker.com homepage - screenshot from docker.com - Image by Author
Docker.com homepage โ€“ screenshot from docker.com โ€“ Image by Author

Once itโ€™s done downloading, as with any other apps, just follow the very straightforward installation steps.

STEP 1/2:

1- Drag the docker app to your Applications folder to install it

2- Accept the Docker Service Agreement

๐Ÿ‘ Steps 1 and 2 - Screenshots from Author - Docker installer
Steps 1 and 2 โ€“ Screenshots from Author โ€“ Docker installer

STEP 3/4:

3- You can create a Docker account if you wish, or you can skip this part, it is not necessary in our case

4- Finally, go ahead with the recommended settings to complete the installation of Docker Desktop

๐Ÿ‘ Steps 3 and 4โ€” Screenshots from Author - Docker installer
Steps 3 and 4โ€” Screenshots from Author โ€“ Docker installer

At this stage, docker is now installed and should look like this (I immediately switch to dark mode for obvious reasons):

๐Ÿ‘ Docker Desktop homepage - Screenshot from Author
Docker Desktop homepage โ€“ Screenshot from Author

You can minimize Docker for now, as the next step is to install Open WebUI!


4 Installing Open WebUI

To install Open WebUI, go to https://docs.openwebui.com/ :

๐Ÿก Home | Open WebUI

If you scroll down just a little bit, youโ€™ll find the recommended installation section (through Docker):

๐Ÿ‘ Open WebUI open source documentation - Screenshot by Author
Open WebUI open source documentation โ€“ Screenshot by Author

What youโ€™re after is the command that I highlighted in red here.

docker run -d -p 3000:8080 โ€“ add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data โ€“ name open-webui โ€“ restart always ghcr.io/open-webui/open-webui:main

Just running that command in the terminal will download the Open WebUI Docker image and run it:

๐Ÿ‘ Installing Open WebUI through the terminal - Image by Author
Installing Open WebUI through the terminal โ€“ Image by Author

If you now go back to Docker Desktop (which you had previously minimized), you will see this container running:

๐Ÿ‘ Open WebUI running through Docker - Image by Author
Open WebUI running through Docker โ€“ Image by Author

5 Running Open WebUI

In Docker Desktop, if you click on that 3000:8080 link in the "Port(s)" column, it will open the following url in your web browser:

http://localhost:3000/auth

and you should see the login page.

Open WebUI requires you to sign up before using it. Once itโ€™s done you can just login:

๐Ÿ‘ Login page when running Open WebUI - Image by Author
Login page when running Open WebUI โ€“ Image by Author

And once logged in, you should end up on the main page of Open WebUI, running on localhost:3000, and it should look like this:

๐Ÿ‘ Open WebUI running on localhost:3000 - Image by Author
Open WebUI running on localhost:3000 โ€“ Image by Author

The next and last step is to select a model thanks to the dropdown menu on the top left. It shows the list of all the models previously downloaded through Ollama.

In my case I only downloaded llama3 8B, so thatโ€™s the one Iโ€™m going to use.

๐Ÿ‘ Selecting a model in Open WebUI - Image by Author
Selecting a model in Open WebUI โ€“ Image by Author

And the last thing left to do is to use it!

๐Ÿ‘ Using Llama3 through the Open WebUI interface - Image by Author
Using Llama3 through the Open WebUI interface โ€“ Image by Author

The response time of the model will typically depend on the GPU / RAM of your computer.


6 In Summary

To sum up, in order to run an LLM (Llama 3 for example) locally on your computer and through a neat user interface (Open WebUI) you need to:

  1. Install Ollama on your computer
  2. Download Llama 3 (or any other open source LLM)
  3. Install Docker on your computer
  4. Install and run Open WebUI locally thanks to Docker
  5. Run Llama 3 through the Open WebUI interface

Steps 1 and 2 are super easy and I described them in details in this article:

Running Local LLMs is More Useful and Easier Than You Think

Steps 3, 4 and 5 were the focus of this article.

And hopefully you found it useful!


7 Final Thoughts

The intent of this article was to highlight the simplicity of running a local LLM through Open WebUI.

I just scratched the surface here, as Open WebUI can do much more than just running a model. Things like uploading files, generating images or feeding the model with your own knowledge base is very accessible through this tool.

Food for thought.


Thanks for reading all the way to the end of the article. Follow for more! Feel free to leave a message below, or reach out to me through LinkedIn / X if you have any questions / remarks!

Get an email whenever Guillaume Weingertner publishes.


Written By

Guillaume Weingertner

Towards Data Science is a community publication. Submit your insights to reach our global audience and earn through the TDS Author Payment Program.

Write for TDS

Related Articles