TejAndrewsACC commited on
Commit
cf1be5a
·
verified ·
1 Parent(s): cd88b90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -30
app.py CHANGED
@@ -1,4 +1,3 @@
1
- import gradio as gr
2
  from gradio_client import Client
3
 
4
  # Initialize the client
@@ -9,19 +8,17 @@ context = ""
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 the chatbot interaction
16
- def chat(user_input, history=None):
17
- global context
18
- if history is None:
19
- history = []
20
-
21
  if user_input.lower() == "exit":
22
- # Append exit message in tuple format
23
- history.append(["assistant", "Ending session. Goodbye!"])
24
- return history
25
 
26
  # Construct the modified input including system instructions and context
27
  modified_input = (
@@ -31,27 +28,13 @@ def chat(user_input, history=None):
31
  )
32
 
33
  # Get the AI's response
34
- ai_response = client.predict(
35
  message=modified_input,
36
  api_name="/chat"
37
  )
38
 
39
- # Update the context with the latest conversation
40
- context += f"User: {user_input}\nAI: {ai_response}\n"
41
-
42
- # Append the conversation to the history in the tuple format
43
- history.append(["user", user_input])
44
- history.append(["assistant", ai_response])
45
 
46
- return history
47
-
48
- # Gradio interface using the Chatbot template
49
- interface = gr.Interface(
50
- fn=chat,
51
- inputs=["text", "state"],
52
- outputs=["chatbot", "state"],
53
- live=True
54
- )
55
-
56
- # Launch the chatbot
57
- interface.launch()
 
 
1
  from gradio_client import Client
2
 
3
  # Initialize the client
 
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 = (
 
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”