Drexx-Ai-Chat / app.py
Drexx007's picture
Update app.py
e8ed037
raw
history blame
665 Bytes
import openai
import gradio
openai.api_key = "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"
messages = [{"role": "system", "content": "You are a psychologist"}]
def CustomChatGPT(user_input):
messages.append({"role": "user", "content": "user_input"})
response = openai.ChatCompletion.create(
model = "gpt-3.5-turbo",
messages = messages
)
ChatGPT_reply = response["choices"][0]["message"]["content"]
messages.append({"role": "assistant", "content": ChatGPT_reply})
return ChatGPT_reply
demo = gradio.Interface(fn=CustomChatGPT, inputs = "text", outputs = "text", title = "Drexx Chat Ai")
demo.launch(share="true")