dylanmeca commited on
Commit
523cdb1
Β·
1 Parent(s): cfe4693

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -24,9 +24,6 @@ class chatgpt:
24
  self.conversation.append({'role': response.choices[0].message.role, 'content': response.choices[0].message.content})
25
  return self.history, self.history
26
 
27
- def system_message(self, systemmessage):
28
- self.conversation.append({"role": "system", "content": f"{systemmessage}"})
29
-
30
  def Clean(self):
31
  self.history.clear()
32
  self.conversation.clear()
@@ -40,12 +37,9 @@ with block:
40
  gr.Markdown("""<h1><center>πŸ€– ChatGPT-Assistant 🐍</center></h1>
41
  <p><center>ChatGPT-Assistant is a chatbot that uses the gpt-3.5-turbo model</center></p>
42
  """)
43
- api_key = gr.Textbox(type="password", label="Enter your OpenAI API key here", placeholder="sk-...0VYO")
44
- system = gr.Textbox(label="System message", placeholder="You are a helpful assistant.")
45
- sub = gr.Button("Send system message")
46
- sub.click(chatgpt.system_message, inputs=[system])
47
  chatbot = gr.Chatbot()
48
- message = gr.Textbox(label="Message", placeholder="Hi, how are things ?")
49
  state = gr.State()
50
  submit = gr.Button("Send")
51
  submit.click(chatgpt.answer_chatgpt, inputs=[api_key, message, state], outputs=[chatbot, state])
 
24
  self.conversation.append({'role': response.choices[0].message.role, 'content': response.choices[0].message.content})
25
  return self.history, self.history
26
 
 
 
 
27
  def Clean(self):
28
  self.history.clear()
29
  self.conversation.clear()
 
37
  gr.Markdown("""<h1><center>πŸ€– ChatGPT-Assistant 🐍</center></h1>
38
  <p><center>ChatGPT-Assistant is a chatbot that uses the gpt-3.5-turbo model</center></p>
39
  """)
40
+ api_key = gr.Textbox(type="password", label="Enter your OpenAI API key here")
 
 
 
41
  chatbot = gr.Chatbot()
42
+ message = gr.Textbox(label="Message")
43
  state = gr.State()
44
  submit = gr.Button("Send")
45
  submit.click(chatgpt.answer_chatgpt, inputs=[api_key, message, state], outputs=[chatbot, state])