Web3Daily commited on
Commit
a389f24
1 Parent(s): 1af188b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -3,19 +3,21 @@ import gradio as gr
3
 
4
  openai.api_key = "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"
5
 
 
 
6
  def CustomChatGPT(user_input):
7
- 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."}]
8
  messages.append({"role": "user", "content": user_input})
9
  response = openai.ChatCompletion.create(
10
  model="gpt-3.5-turbo",
11
  messages=messages
12
  )
13
  ChatGPT_reply = response["choices"][0]["message"]["content"]
 
14
  return ChatGPT_reply
15
 
16
  demo = gr.Interface(
17
  fn=CustomChatGPT,
18
- inputs=gr.inputs.Text(label="Ask a question"), # Add a label to the input component
19
  outputs="text",
20
  title="Web(GPT)3 Daily"
21
  )
 
3
 
4
  openai.api_key = "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"
5
 
6
+ 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."}]
7
+
8
  def CustomChatGPT(user_input):
 
9
  messages.append({"role": "user", "content": user_input})
10
  response = openai.ChatCompletion.create(
11
  model="gpt-3.5-turbo",
12
  messages=messages
13
  )
14
  ChatGPT_reply = response["choices"][0]["message"]["content"]
15
+ messages.append({"role": "assistant", "content": ChatGPT_reply})
16
  return ChatGPT_reply
17
 
18
  demo = gr.Interface(
19
  fn=CustomChatGPT,
20
+ inputs=gr.inputs.Text(placeholder="Ask a question"), # Set the placeholder text for the input component
21
  outputs="text",
22
  title="Web(GPT)3 Daily"
23
  )