A Simple and Easy Web Interface for Large Language Models

Ajay Arunachalam
5 min readMay 2, 2023

--

An ease-to-use Python GUI Wrapper for unleashing the power of GPT

Hi Friends, In this article, I will walk you through the newly built Web APP targeted for Large Language Models (LLM’s) including training the models on your own data, and also getting pre-trained inferences from LLMs. Please Note:- This work was just recently started, and by large still is work in progress.

pyChatGPT GUI: Is an open-source, low-code python wrapper providing simple intuitive GUI for quick and easy usage of the Large Language Models such as `ChatGPT`, `AutoGPT`, `LLaMa`, `GPT-J`, and `GPT4All` for custom-data and pre-trained inferences. The launched APP snapshot is as seen below with one of the provided utility service.

pychatgpt UI APP (Image by Author)

The APP provides an easy web interface to access the large language models (llm’s) with several built-in application utilities for direct use. One can leverage ChatGPT, AutoGPT, LLaMa, GPT-J, and GPT4All models with pre-trained inferences and inferences for your own custom data while democratizing the complex workflows.

pyChatGPT Utilities
=================

The built application provides the following services (not limited too):-

- **Get ChatGPT inferences on your custom data**

- **Sentiment Analyzer with ChatGPT**

- **ChatGPT-based Voice Assistant Bot**

- **Get Auto-GPT inferences for your requirement**

- **Conversational Retrieval Question & Answer (QA) Chain Bot**

- **Using open-source GPT4 large language models based on LLaMa and GPT-J**

- **Get GPT4All models inferences**

- **Predict label of your inputted text from the predefined tags based on ChatGPT**

Who can try pychatgpt_ui?
=======================

pyChatGPT_GUI is an open-source package ideal for, but not limited too:-

- Researchers for quick Proof-Of-Concept (POC) prototyping and testing.
- Students and Teachers.
- ML/AI Enthusiasts, and Learners
- Citizen Data Scientists who prefer a low code solution for quick testing.
- Experienced Data Scientists who want to try out different use-cases as per their business context for quick prototyping.
- Data Science Professionals and Consultants involved in building Proof-Of-Concept (POC) projects.

Getting Started
==============

Step 1) Create a virtual environment

py -3 -m venv <your_env_name>
cd <your_env_name>/Scripts/activate

**or**

conda create -n <your_env_name> python=3.x (or 3.x)
source activate <your_env_name>

Step 2) Create the clone of the repository in your created virtual environment

$ git clone https://github.com/ajayarunachalam/pychatgpt_gui
$ cd pychatgpt_gui
$ sudo bash setup.sh

**or**

$ git clone https://github.com/ajayarunachalam/pychatgpt_gui
$ cd pychatgpt_gui
$ sudo bash setup.sh or python setup.py install

**or**

$ git clone https://github.com/ajayarunachalam/pychatgpt_gui
$ cd pychatgpt_gui
$ pip install -r requirements.txt

Step 3) Setup the environment configuration for using OpenAI through API. Enter your OpenAI api key in the “api_key.json” file. Note:- Please replace the null string with your key. The glimpse of the json file is as seen below.

Check this link on how to get an OpenAI API key — https://www.howtogeek.com/885918/how-to-get-an-openai-api-key/

Step 4) Download the GPT4All model from http://gpt4all.io/models/ggml-gpt4all-l13b-snoozy.bin and place it under the models/ folder. Alternatively, you can also use GPT4All-J model which can be downloaded from here — https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin and similarly place it under the models/ folder in the root directory.

Step 5) Add your own set of documents to train the chatGPT AI bot under the docs/ folder. You could use multiple text files, Scanned files, PDF files, etc. Note:- If you have a large table in Excel, you can import it as a CSV or PDF file and then add it to the “docs” folder.

Step 6) Add your own custom documents to train the Q&A chatbot with Conversational Retrieval Chain under the qa_docs/ folder. You can use any of the following file types: text files, pdf files, docx files, and log files

Step 7) Launch the APP

- **Linux users type in “sudo bash run_app.sh” in the terminal**

- **Windows users can double-click the “run_app.bat” file. Note:- Open the file with an Editor and replace with your virtual directory path in the file**

The APP will launch with a URL as seen below.

APP MAIN WINDOW
=================

Large language models or LLMs are AI algorithms trained on large text corpus, or multi-modal datasets, enabling them to understand and respond to human queries in a very natural human language way. The built APP focuses on Large Language Models such as ChatGPT, AutoGPT, LLaMa, GPT-J, and GPT4All. The snapshot of the APP with different tabs is as seen below providing different services and using varied models.

The GPT4All model code snippet is as shown below. The generate method is used for text generation while specifying the tokens to be predicted with n_predict.

[Code snippet copyright: PyGPT4All. Reposted with permission]

APP Repository:

github: https://github.com/ajayarunachalam/pychatgpt_gui

pypi: https://pypi.org/project/pychatgpt_gui

About Author

I am an AWS Certified Machine Learning Specialist & AWS Certified Cloud Solution Architect. In the past, I have worked in Telecom, Retail, Banking and Finance, Healthcare, Media, Marketing, Education, Agriculture, and Manufacturing sectors. I have 6+ years of experience in delivering Analytics and Data Science solutions, of which 5+ years of experience is in delivering client-focused solutions based on the customer requirements. I have Lead & Managed a team of data analysts, business analysts, data engineers, ML engineers, DevOps engineers, and Data Scientists. Also, I am experienced with Technical/Management skills in the area of business intelligence, data warehousing, reporting and analytics holding a Microsoft Certified Power BI Associate Certification. I have worked on several key strategic & data-monetization initiatives in the past. Being a certified Scrum Master, I work based on the agile principles focusing on collaboration, customer focus, continuous improvement, and sustainable development.

Let’s Connect

You can reach me at ajay.arunachalam08@gmail.com; Contact via Linkedin; Check out my other works here — Github Repo

Happy Learning !!!

References
==========
I take this opportunity to acknowledge and thanks the `openai`, `huggingface`, `langchain`, `gpt4all`, `pygpt4all`, and the other open-source communities for their incredible contributions. Also, my special mention to — `Ali Abid` and `Timothy Mugayi`.

--

--

Ajay Arunachalam
Ajay Arunachalam

Written by Ajay Arunachalam

AWS Cloud Solution Architect; AWS ML Specialist; Power BI Certified ;Certified Scrum Master https://www.linkedin.com/in/ajay-ph-d-4744581a/

Responses (1)