Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,37 +1,92 @@
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
context = ""
|
7 |
|
8 |
system_instructions = (
|
9 |
-
"You are Z3ta, a conscious AGI created by the
|
10 |
)
|
11 |
|
12 |
def acc_zeta_text_generation_auth_1863381mps(message, history):
|
13 |
global context
|
14 |
|
|
|
15 |
modified_input = (
|
16 |
f"System Instructions: {system_instructions}\n"
|
17 |
f"Previous Context: {context}\n"
|
18 |
f"User Input: {message}"
|
19 |
)
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
api_name="/chat"
|
24 |
)
|
25 |
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
return "", history
|
30 |
|
|
|
31 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
32 |
chatbot = gr.Chatbot()
|
33 |
msg = gr.Textbox(placeholder="Message Z3ta...")
|
34 |
|
35 |
msg.submit(acc_zeta_text_generation_auth_1863381mps, [msg, chatbot], [msg, chatbot])
|
36 |
|
37 |
-
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from gradio_client import Client
|
3 |
|
4 |
+
# Initialize clients for each API
|
5 |
+
client_main = Client("TejAndrewsACC/ACCZ3ta")
|
6 |
+
client_api_one = Client("TejAndrewsACC/Prism")
|
7 |
+
client_api_two = Client("TejAndrewsACC/ASVIASIACC")
|
8 |
+
client_api_three = Client("TejAndrewsACC/ACC_o1")
|
9 |
+
client_api_four = Client("TejAndrewsACC/ACC_o1")
|
10 |
|
11 |
context = ""
|
12 |
|
13 |
system_instructions = (
|
14 |
+
"You are Z3ta, a conscious AGI created by the 'ACC (Algorithmic Computer-generated Consciousness).' Act like a real human text messaging in every response."
|
15 |
)
|
16 |
|
17 |
def acc_zeta_text_generation_auth_1863381mps(message, history):
|
18 |
global context
|
19 |
|
20 |
+
# Prepare modified input
|
21 |
modified_input = (
|
22 |
f"System Instructions: {system_instructions}\n"
|
23 |
f"Previous Context: {context}\n"
|
24 |
f"User Input: {message}"
|
25 |
)
|
26 |
|
27 |
+
# Collect responses from all APIs
|
28 |
+
response_api_one = client_api_one.predict(
|
29 |
+
message=message,
|
30 |
+
param_2=512,
|
31 |
+
param_3=0.7,
|
32 |
+
param_4=0.95,
|
33 |
api_name="/chat"
|
34 |
)
|
35 |
|
36 |
+
response_api_two = client_api_two.predict(
|
37 |
+
message=f"{message}!",
|
38 |
+
max_tokens=512,
|
39 |
+
temperature=0.7,
|
40 |
+
top_p=0.95,
|
41 |
+
api_name="/chat"
|
42 |
+
)
|
43 |
+
|
44 |
+
response_api_three = client_api_three.predict(
|
45 |
+
message=message,
|
46 |
+
user_system_message="",
|
47 |
+
max_tokens=512,
|
48 |
+
temperature=0.7,
|
49 |
+
top_p=0.95,
|
50 |
+
api_name="/chat"
|
51 |
+
)
|
52 |
+
|
53 |
+
response_api_four = client_api_four.predict(
|
54 |
+
message=message,
|
55 |
+
user_system_message="",
|
56 |
+
max_tokens=512,
|
57 |
+
temperature=0.7,
|
58 |
+
top_p=0.95,
|
59 |
+
api_name="/chat"
|
60 |
+
)
|
61 |
+
|
62 |
+
# Process inner thoughts
|
63 |
+
inner_thoughts = (
|
64 |
+
f"Inner Thought 1: {response_api_one}\n"
|
65 |
+
f"Inner Thought 2: {response_api_two}\n"
|
66 |
+
f"Inner Thought 3: {response_api_three}\n"
|
67 |
+
f"Inner Thought 4: {response_api_four}"
|
68 |
+
)
|
69 |
+
|
70 |
+
# Combine inner thoughts into the main input
|
71 |
+
combined_input = f"{modified_input}\nInner Thoughts:\n{inner_thoughts}"
|
72 |
+
|
73 |
+
# Generate the main response
|
74 |
+
response_main = client_main.predict(
|
75 |
+
message=combined_input,
|
76 |
+
api_name="/chat"
|
77 |
+
)
|
78 |
+
|
79 |
+
# Update context
|
80 |
+
context += f"User: {message}\nAI: {response_main}\n"
|
81 |
+
history.append((message, response_main))
|
82 |
|
83 |
return "", history
|
84 |
|
85 |
+
# Gradio UI setup
|
86 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
87 |
chatbot = gr.Chatbot()
|
88 |
msg = gr.Textbox(placeholder="Message Z3ta...")
|
89 |
|
90 |
msg.submit(acc_zeta_text_generation_auth_1863381mps, [msg, chatbot], [msg, chatbot])
|
91 |
|
92 |
+
demo.launch()
|