Skip to content

awiggins12/simple-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-chat

Simple gradio interface for the ChatGPT API

Current Features

Alt text

Installation

Installing Python:

Go to https://www.python.org/ to download and install the latest version of Python for your operating system.

Follow the instructions to download and run the installer.

Open the Windows Command Prompt by pressing the "Windows" key and typing "Command Prompt". Once the command prompt is open type "python" to check if Python is installed properly.

Alt text

Installing Libraries:

In command prompt type "pip install gradio==3.16.2" and hit enter.

Alt text

Make sure to run the rest of the commands as well:

pip install gradio==3.16.2
pip install openai
pip install markdown
pip install python-dotenv

Instead of the above - if you have cloned the repository (or downloaded requirements.txt) you can simply run:

pip install -r requirements.txt

Which will install the libraries in one command rather than multiple.

Generate OpenAI API Key

Go to https://platform.openai.com/account/api-keys and click "Create new secret key" and record the key for later

Installing and running

To get the file, right click on this link and select "Save As".

In Windows Explorer navigate to where simple-chat.py is saved.

Click in the address bar type "cmd" then enter.

Alt text

Command prompt will open, type in "simple-chat.py" and click enter.

Alt text

After a moment the simple-chat user interface will launch in your web browser.

Copy and paste your OpenAPI key into the prompt at the top of the page.

Alt text

Quit or restart web page

To quit the application, you can hit ctrl+c in command prompt to kill the thread. Sometimes it will need to be run multiple times. You can hit the up key to cycle through your recent commands in order to quickly relaunch Simple Chat.

Alternatively, you can just close command prompt to kill the web server.

Troubleshooting

  • If you ran into any issues check command prompt for the errors and post them. I'll try to help you figure out the issues.
  • If you have any of the libraries already installed, I suggest uninstalling and re-installing them. Specifically, this app works best with an older version of Gradio and I recently updated my instructions above to use that older version. ** Running this will install the correct version over any existing versions.
pip install --force-reinstall gradio==3.16.2
  • If for some reason you need to change your Open API key you can either delete the .env file (which will prompt you to enter on the next launch of the app) or you can edit the file directly in your text editor of choice.

Known issues

  • Max token length is not being handled, so 4000+ tokens will result in no response
  • No robust error handling
  • Markdown doesn't always work correctly and new lines are not being added correctly
  • I haven't done full time development in 10 years...

Donate

Buy me a coffee

About

Simple gradio interface for the ChatGPT API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages