Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,9 +24,8 @@ 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,
|
| 28 |
self.conversation.clear()
|
| 29 |
-
self.model_id = str(modelid)
|
| 30 |
self.conversation = [{"role": "system", "content": f"{systemm}"},]
|
| 31 |
|
| 32 |
def Clean(self):
|
|
@@ -44,10 +43,9 @@ with block:
|
|
| 44 |
<p><center>ChatGPT-Assistant is a chatbot that uses the gpt-3.5-turbo model</center></p>
|
| 45 |
""")
|
| 46 |
api_key = gr.Textbox(type="password", label="Enter your OpenAI API key here", placeholder="sk-...0VYO")
|
| 47 |
-
modelid = gr.Textbox(label="Model ID", placeholder="gpt-3.5-turbo")
|
| 48 |
systemm = gr.Textbox(label="System message", placeholder="You are a helpful assistant.")
|
| 49 |
-
submit_system = gr.Button("Send
|
| 50 |
-
submit_system.click(chatgpt.system_message, inputs=[
|
| 51 |
chatbot = gr.Chatbot()
|
| 52 |
message = gr.Textbox(label="Message", placeholder="Hi, how are things ?")
|
| 53 |
state = gr.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 system_message(self, systemm):
|
| 28 |
self.conversation.clear()
|
|
|
|
| 29 |
self.conversation = [{"role": "system", "content": f"{systemm}"},]
|
| 30 |
|
| 31 |
def Clean(self):
|
|
|
|
| 43 |
<p><center>ChatGPT-Assistant is a chatbot that uses the gpt-3.5-turbo model</center></p>
|
| 44 |
""")
|
| 45 |
api_key = gr.Textbox(type="password", label="Enter your OpenAI API key here", placeholder="sk-...0VYO")
|
|
|
|
| 46 |
systemm = gr.Textbox(label="System message", placeholder="You are a helpful assistant.")
|
| 47 |
+
submit_system = gr.Button("Send system message")
|
| 48 |
+
submit_system.click(chatgpt.system_message, inputs=[systemm])
|
| 49 |
chatbot = gr.Chatbot()
|
| 50 |
message = gr.Textbox(label="Message", placeholder="Hi, how are things ?")
|
| 51 |
state = gr.State()
|