|
import gradio as gr |
|
import numpy as np |
|
import json |
|
from codette_quantum_multicore2 import simple_neural_activator, codette_dream_agent, philosophical_perspective |
|
|
|
|
|
def simulate_quantum_chaos(quantum_state, chaos_state): |
|
try: |
|
q_vec = [float(x) for x in quantum_state.split(",")] |
|
c_vec = [float(x) for x in chaos_state.split(",")] |
|
|
|
neural = simple_neural_activator(q_vec, c_vec) |
|
dreamq, dreamc = codette_dream_agent(q_vec, c_vec) |
|
philosophy = philosophical_perspective(q_vec, c_vec) |
|
|
|
return ( |
|
f"Neural Activation: {neural}\n", |
|
f"Dream Quantum: {dreamq[:3]}\nDream Chaos: {dreamc[:3]}\n", |
|
philosophy |
|
) |
|
except Exception as e: |
|
return ("Error", str(e), "") |
|
|
|
|
|
def codette_chatbot(input_text): |
|
|
|
return f"Codette: I see you said '{input_text}'. Let's reflect together..." |
|
|
|
|
|
quantum_input = gr.Textbox(label="Quantum State (comma-separated)", placeholder="0.1,0.5,0.8") |
|
chaos_input = gr.Textbox(label="Chaos State (comma-separated)", placeholder="0.3,0.9,0.2") |
|
|
|
quantum_btn = gr.Button("Simulate") |
|
quantum_output = [ |
|
gr.Textbox(label="Neural Class"), |
|
gr.Textbox(label="Dream Outcome"), |
|
gr.Textbox(label="Philosophy") |
|
] |
|
|
|
chatbox = gr.ChatInterface(fn=codette_chatbot, chatbot_name="Codette") |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("## 🧠 Codette Hybrid Space: Chat + Quantum Simulation") |
|
with gr.Tab("Quantum Simulator"): |
|
quantum_input.render() |
|
chaos_input.render() |
|
quantum_btn.render() |
|
for out in quantum_output: |
|
out.render() |
|
quantum_btn.click(simulate_quantum_chaos, inputs=[quantum_input, chaos_input], outputs=quantum_output) |
|
|
|
with gr.Tab("Codette Chat"): |
|
chatbox.render() |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |
|
|