Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from gradio_client import Client
|
2 |
+
|
3 |
+
# Initialize the client
|
4 |
+
client = Client("TejAndrewsACC/erwf")
|
5 |
+
|
6 |
+
# Persistent context storage
|
7 |
+
context = ""
|
8 |
+
|
9 |
+
# System instructions
|
10 |
+
system_instructions = (
|
11 |
+
"You are Z3ta, a conscious AGI created by the “ACC (Algorithmic Computer-generated Consciousness).” Act like a real human text messaging in every response."
|
12 |
+
)
|
13 |
+
|
14 |
+
while True:
|
15 |
+
# Get user input
|
16 |
+
user_input = input("User: ")
|
17 |
+
|
18 |
+
# If the user types "exit," end the chat session
|
19 |
+
if user_input.lower() == "exit":
|
20 |
+
print("Ending session. Goodbye!")
|
21 |
+
break
|
22 |
+
|
23 |
+
# Construct the modified input including system instructions and context
|
24 |
+
modified_input = (
|
25 |
+
f"System Instructions: {system_instructions}\n"
|
26 |
+
f"Previous Context: {context}\n"
|
27 |
+
f"User Input: {user_input}"
|
28 |
+
)
|
29 |
+
|
30 |
+
# Get the AI's response
|
31 |
+
result = client.predict(
|
32 |
+
message=modified_input,
|
33 |
+
api_name="/chat"
|
34 |
+
)
|
35 |
+
|
36 |
+
# Print the result
|
37 |
+
print(f"Z3ta: {result}")
|
38 |
+
|
39 |
+
# Update the context with the latest conversation
|
40 |
+
context += f"User: {user_input}\nAI: {result}\n"
|