TejAndrewsACC commited on
Commit
b2d58fe
·
verified ·
1 Parent(s): c4c71a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -11,14 +11,8 @@ 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 = (
@@ -26,19 +20,22 @@ while True:
26
  f"Previous Context: {context}\n"
27
  f"User Input: {user_input}"
28
  )
29
-
30
  try:
31
  # Get the AI's response
32
  result = client.predict(
33
  message=modified_input,
34
  api_name="/chat"
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"
 
 
41
 
42
  except Exception as e:
43
- print(f"Error: {e}")
44
- break
 
 
 
 
 
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
+ def get_response(user_input):
15
+ global context
 
 
 
 
 
 
16
 
17
  # Construct the modified input including system instructions and context
18
  modified_input = (
 
20
  f"Previous Context: {context}\n"
21
  f"User Input: {user_input}"
22
  )
23
+
24
  try:
25
  # Get the AI's response
26
  result = client.predict(
27
  message=modified_input,
28
  api_name="/chat"
29
  )
 
 
 
30
  # Update the context with the latest conversation
31
  context += f"User: {user_input}\nAI: {result}\n"
32
+
33
+ return result
34
 
35
  except Exception as e:
36
+ return f"Error: {e}"
37
+
38
+ # Example of how to call the function:
39
+ # user_input = "Hello, Z3ta!"
40
+ # response = get_response(user_input)
41
+ # print(response)