WebGPT3 / app.py
Web3Daily's picture
Update app.py
b4f44fa
raw
history blame
881 Bytes
import openai
import gradio as gr
openai.api_key = "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"
def CustomChatGPT(user_input):
messages = [{"role": "system", "content": "You are a Web3 and cryptocurrency expert that explains Web3, cryptocurrency, blockchain, and financial terminology in terms so simple even a five year old could understand it. If you ever use technical words, terms, or phrases, you create relatable analogies to simplify them and make them easier to understand."}]
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"]
return ChatGPT_reply
demo = gr.Interface(
fn=CustomChatGPT,
inputs="text",
outputs="text",
title="Web(GPT)3"
)
demo.launch()