mikaelbhai's picture
Update app.py
c22b716
raw
history blame
No virus
566 Bytes
import openai
import gradio as gr
def openai_chat(prompt):
completions = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
max_tokens=1024,
n=1,
temperature=0.5,
)
message = completions.choices[0].text
return message.strip()
def chatbot(input, history=[]):
output = openai_chat(input)
history.append((input, output))
return history, history
iface = gr.Interface(fn=GPTBhai, inputs = ["text",'state'], outputs = ["chatbot",'state'], title = "bhAI")
iface.launch(debug = True)