OpenAI GUI Python3 Script
OpenAI GUI Python3 Script
- Code:
#!/usr/bin/python3
# sudo apt install -y python3-tk
# pip3 install openai
from tkinter import *
import openai
from tkinter import messagebox
root=Tk()
root.geometry("350x500")
root.config(bg="white")
openai.api_key="KEY-HERE"
model_engine="text-davinci-003"
def response():
msg=messagebox.get()
lstbx.insert(0, "You: " + msg)
answer=openai.Completion.create(
engine=model_engine,
prompt=msg,
)
message=answer.choices[0].text
print(message)
lstbx.insert(0, "Bot: " + message)
message=StringVar()
messagebox=Entry(root, textvariable=message, font=('calibre',10,'normal'), border=2, width=32)
messagebox.place(x=10, y=444)
sendmessageimg=PhotoImage(file='send.png')
sendmessagebutton=Button(root, image=sendmessageimg, command=response, borderwidth=0)
sendmessagebutton.place(x=260, y=440)
lstbx=Listbox(root, height=20, width=43)
lstbx.place(x=15, y=80)
user_name=Label(root, text="Number", width=10)
root.mainloop()
Similar topics
» Python3 Auto-Clickers For Windows
» Generate requirements.txt file for python3
» Python3 VENV Setup For Windows & Linux
» Linux BASH Script Running Commands and Functions From Bash Script and saving to varables
» Setup OpenCV for Face Recognition AI On Linux Using Python3
» Generate requirements.txt file for python3
» Python3 VENV Setup For Windows & Linux
» Linux BASH Script Running Commands and Functions From Bash Script and saving to varables
» Setup OpenCV for Face Recognition AI On Linux Using Python3
Permissions in this forum:
You cannot reply to topics in this forum
|
|