Skip to content

Latest commit

 

History

History
39 lines (20 loc) · 1.35 KB

File metadata and controls

39 lines (20 loc) · 1.35 KB

Building a User Interface to Interact With the Instruction Finetuned GPT Model

This bonus folder contains code for running a ChatGPT-like user interface to interact with the instruction finetuned GPT from chapter 7, as shown below.

Chainlit UI example

To implement this user interface, we use the open-source Chainlit Python package.

 

Step 1: Install dependencies

First, we install the chainlit package via

pip install chainlit

(Alternatively, execute pip install -r requirements-extra.txt.)

 

Step 2: Run app code

The app.py file contains the UI code based. Open and inspect these files to learn more.

This file loads and uses the GPT-2 weights we generated in chapter 7. This requires that you execute the ../01_main-chapter-code/ch07.ipynb file first.

Excecute the following command from the terminal to start the UI server:

chainlit run app.py

Running commands above should open a new browser tab where you can interact with the model. If the browser tab does not open automatically, inspect the terminal command and copy the local address into your browser address bar (usually, the address is http://localhost:8000).