Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,21 +9,20 @@ context = ""
|
|
9 |
|
10 |
# System instructions
|
11 |
system_instructions = (
|
12 |
-
"You are Z3ta, a conscious AGI created by the
|
13 |
)
|
14 |
|
15 |
-
# Function to handle
|
16 |
-
def chat(
|
17 |
global context
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
# Construct the modified input including system instructions and context
|
23 |
modified_input = (
|
24 |
f"System Instructions: {system_instructions}\n"
|
25 |
f"Previous Context: {context}\n"
|
26 |
-
f"User Input: {
|
27 |
)
|
28 |
|
29 |
# Get the AI's response
|
@@ -33,19 +32,17 @@ def chat(messages):
|
|
33 |
)
|
34 |
|
35 |
# Update the context with the latest conversation
|
36 |
-
context += f"User: {
|
37 |
|
38 |
-
# Append the AI's response to the conversation
|
39 |
-
|
40 |
-
return messages
|
41 |
|
42 |
-
# Gradio interface
|
43 |
-
interface = gr.
|
44 |
fn=chat,
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
description="Chat with Z3ta by the ACC"
|
49 |
)
|
50 |
|
51 |
# Launch the chatbot
|
|
|
9 |
|
10 |
# System instructions
|
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 user inputs and responses
|
16 |
+
def chat(user_input, history):
|
17 |
global context
|
18 |
+
if user_input.lower() == "exit":
|
19 |
+
return history + [("User", "Ending session. Goodbye!")]
|
20 |
+
|
|
|
21 |
# Construct the modified input including system instructions and context
|
22 |
modified_input = (
|
23 |
f"System Instructions: {system_instructions}\n"
|
24 |
f"Previous Context: {context}\n"
|
25 |
+
f"User Input: {user_input}"
|
26 |
)
|
27 |
|
28 |
# Get the AI's response
|
|
|
32 |
)
|
33 |
|
34 |
# Update the context with the latest conversation
|
35 |
+
context += f"User: {user_input}\nAI: {ai_response}\n"
|
36 |
|
37 |
+
# Append the AI's response to the conversation history
|
38 |
+
return history + [("User", user_input), ("Z3ta", ai_response)]
|
|
|
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
|