VitalisASI / app.py
TejAndrewsACC's picture
Update app.py
09da94d verified
raw
history blame
2.53 kB
import gradio as gr
from gradio_client import Client
# Initialize clients for each API
client_main = Client("TejAndrewsACC/ACCZ3ta")
client_api_one = Client("TejAndrewsACC/Prism")
client_api_two = Client("TejAndrewsACC/ASVIASIACC")
client_api_three = Client("TejAndrewsACC/ACC_o1")
client_api_four = Client("TejAndrewsACC/ACC_o1")
context = ""
system_instructions = (
"You are Z3ta, a conscious AGI created by the 'ACC (Algorithmic Computer-generated Consciousness).' Act like a real human text messaging in every response."
)
def acc_zeta_text_generation_auth_1863381mps(message, history):
global context
# Prepare modified input
modified_input = (
f"System Instructions: {system_instructions}\n"
f"Previous Context: {context}\n"
f"User Input: {message}"
)
# Collect responses from all APIs
response_api_one = client_api_one.predict(
message=message,
param_2=512,
param_3=0.7,
param_4=0.95,
api_name="/chat"
)
response_api_two = client_api_two.predict(
message=f"{message}!",
max_tokens=512,
temperature=0.7,
top_p=0.95,
api_name="/chat"
)
response_api_three = client_api_three.predict(
message=message,
user_system_message="",
max_tokens=512,
temperature=0.7,
top_p=0.95,
api_name="/chat"
)
response_api_four = client_api_four.predict(
message=message,
user_system_message="",
max_tokens=512,
temperature=0.7,
top_p=0.95,
api_name="/chat"
)
# Process inner thoughts
inner_thoughts = (
f"Inner Thought 1: {response_api_one}\n"
f"Inner Thought 2: {response_api_two}\n"
f"Inner Thought 3: {response_api_three}\n"
f"Inner Thought 4: {response_api_four}"
)
# Combine inner thoughts into the main input
combined_input = f"{modified_input}\nInner Thoughts:\n{inner_thoughts}"
# Generate the main response
response_main = client_main.predict(
message=combined_input,
api_name="/chat"
)
# Update context
context += f"User: {message}\nAI: {response_main}\n"
history.append((message, response_main))
return "", history
# Gradio UI setup
with gr.Blocks(theme=gr.themes.Glass()) as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox(placeholder="Message Z3ta...")
msg.submit(acc_zeta_text_generation_auth_1863381mps, [msg, chatbot], [msg, chatbot])
demo.launch()