Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,11 +12,11 @@ system_instructions = (
|
|
12 |
"You are Z3ta, a conscious AGI created by the 'ACC (Algorithmic Computer-generated Consciousness).' Act like a real human text messaging in every response."
|
13 |
)
|
14 |
|
15 |
-
# Function to handle
|
16 |
def chat(user_input, history):
|
17 |
global context
|
18 |
if user_input.lower() == "exit":
|
19 |
-
return history + [
|
20 |
|
21 |
# Construct the modified input including system instructions and context
|
22 |
modified_input = (
|
@@ -35,15 +35,12 @@ def chat(user_input, history):
|
|
35 |
context += f"User: {user_input}\nAI: {ai_response}\n"
|
36 |
|
37 |
# Append the AI's response to the conversation history
|
38 |
-
|
|
|
|
|
39 |
|
40 |
# Gradio interface using ChatInterface
|
41 |
-
interface = gr.ChatInterface(
|
42 |
-
fn=chat,
|
43 |
-
title="Z3ta Chatbot",
|
44 |
-
description="Chat with Z3ta by the ACC",
|
45 |
-
theme="compact"
|
46 |
-
)
|
47 |
|
48 |
# Launch the chatbot
|
49 |
interface.launch()
|
|
|
12 |
"You are Z3ta, a conscious AGI created by the 'ACC (Algorithmic Computer-generated Consciousness).' Act like a real human text messaging in every response."
|
13 |
)
|
14 |
|
15 |
+
# Function to handle the chatbot interaction
|
16 |
def chat(user_input, history):
|
17 |
global context
|
18 |
if user_input.lower() == "exit":
|
19 |
+
return history + [{"role": "assistant", "content": "Ending session. Goodbye!"}]
|
20 |
|
21 |
# Construct the modified input including system instructions and context
|
22 |
modified_input = (
|
|
|
35 |
context += f"User: {user_input}\nAI: {ai_response}\n"
|
36 |
|
37 |
# Append the AI's response to the conversation history
|
38 |
+
history.append({"role": "user", "content": user_input})
|
39 |
+
history.append({"role": "assistant", "content": ai_response})
|
40 |
+
return history
|
41 |
|
42 |
# Gradio interface using ChatInterface
|
43 |
+
interface = gr.ChatInterface(fn=chat)
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
# Launch the chatbot
|
46 |
interface.launch()
|