8000 GitHub - ag-python-qt/pyqt-openai at 77d46039dd8afd082cc195769ef7adb3b9de662d
[go: up one dir, main page]

Skip to content

ag-python-qt/pyqt-openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyqt-openai

Example of using OpenAI with PyQt (Python cross-platform GUI toolkit)

This shows an example of using OpenAI with PyQt as a chatbot and using DALL-E or Stable Diffusion as a image generation tool.

Even though this project has become too huge to be called an 'example'.

The major advantage of this package is that you don't need to know other language aside from Python.

If you want to study openai with Python-only good old desktop software, this is for you.

The OpenAI model this package uses is the gpt-3.5-turbo model(which is nearly as functional as ChatGPT) by default. You can use gpt-4 as well.

Image generation feature(DALL-E and Stable Diffusion) available since v0.1.4.

Stable Diffusion used DreamStudio API. This is not entirely free like stable-diffusion-webgui.

But this is very lightweight and more accessible. don't need CUDA, torch, expansive PC, anything.

This is using sqlite as a database.

You can select the model at the right side bar.

An internet connection is required.

Contact

You can join pyqt-openai's Discord Server to have a conversation about it or AI-related stuff 🙂

Note

Some of the features are still being tested.

I recommend to install sqlite management software. It's not necessary to run this app (obviously), but it's good practice to manage database about conversation history with AI and to 8000 know how this works.

Feature

  • basically this is desktop application version of ChatGPT with image generation tool.
    • text streaming (enable by default, you can disable it)
    • AI remembers past conversation
  • conversation management
    • add & delete conversations
    • save conversations
    • rename conversation
    • everything above is saved in an SQLite database file named conv.db.
  • support GPT-4 and every other models below GPT3
  • support prompt generator (manageable)
  • support beginning and ending part of the prompt
  • you can run this in background application
    • notification will pop up when response is generated
  • you can make window stack on top or control its transparency
  • image generation (DALL-E, Stable Diffusion with DreamStudio API)

Requirements

  • qtpy - the package allowing you to write code that works with both PyQt and PySide
  • PyQt5 >= 5.14 or PySide6
  • openai
  • pyperclip - to copy prompt template from prompt generator
  • stability_sdk - for Stable Diffusion

Preview

This is using GPT-3.5 turbo model by default.

Homepage

Note: Some of these previews are not the latest.

image You have to write your openai api key inside the red box. see How to play

Overview

image

Conversation preview

Preview Image

image

Preview Video

PyQt.OpenAI.Chatbot.2023-05-06.08-16-48.mp4

Prompt Generator

Preview 1 (v0.1.22)

PyQt.OpenAI.Chatbot.2023-05-06.08-27-56.mp4

Preview 2 (v0.1.3)

2023-05-07.13-52-15.mp4

So sorry to weak preview, but i have a lot of idea about this prompt generator! Just wait.

Image Generation

image

Again, weak preview (i just gave prompt text as "A" which is pathetic) but please consider this is very first version of sd image generation (v0.1.4) so just wait

How to play

  1. git clone ~
  2. from the root directory, type "cd pyqt_openai"
  3. You should put your api key in the line edit. You can get it in official site of openai. Sign up and log in before you get it. By the way, this is free trial, not permanently free. See this after you have logged in.

Be sure, this is a very important API key that belongs to you only, so you should remember it and keep it secure.

  1. python main.py

If installation doesn't work, check the troubleshooting below.

Troubleshooting

If you see this error while installing the openai package

subprocess-exited-with-error

you can shout a curse word and just download the package itself from pypi.

Unzip it, access the package directory, type

python setup.py install

That will install the openai.

TODO list

  • auto-complete prompt command
  • DB for images (to further experiement of both DALL-E and Stable Diffusion or other image generation engine)
  • show the explanation of every model and terms related to AI (e.g. temperature, topp..)
  • save conversation history with other format (xlsx, csv, etc.)
  • tokenizer
  • highlight the source (optional, eventually)
  • support multiple language
  • use SQLAlchemy (maybe not)
  • show reason when the chat input is disabled for some reasons
  • add the basic example sources of making deep learning model with PyTorch (eventually)

See Also

About

PyQt/PySide (Python cross-platform GUI toolkit) OpenAI Chatbot

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0