Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -104,14 +104,14 @@ with gr.Blocks(title="DEFRAG NODE") as demo:
|
|
| 104 |
audio_player = gr.Audio(label="System Voice", visible=True, interactive=False)
|
| 105 |
|
| 106 |
# 3. CHAT LAYER (Bottom)
|
| 107 |
-
chatbot = gr.Chatbot(label="DEFRAG // LOG", elem_classes="chat-window")
|
| 108 |
-
msg = gr.Textbox(placeholder="Input System Status...", show_label=False)
|
| 109 |
|
| 110 |
# Hidden Data Bridge
|
| 111 |
-
visual_data = gr.JSON(visible=False)
|
| 112 |
# --- EVENT WIRING ---
|
| 113 |
|
| 114 |
-
def respond(message, chat_history):
|
| 115 |
# Run logic
|
| 116 |
bot_msg, audio, viz_data = chat_interaction(message, chat_history)
|
| 117 |
|
|
@@ -121,9 +121,9 @@ def respond(message, chat_history):
|
|
| 121 |
|
| 122 |
return "", chat_history, audio, viz_data
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
(args) => {
|
| 128 |
if (window.hexa) {
|
| 129 |
// args = [hex, petals, elem, stability, speaking]
|
|
@@ -137,7 +137,7 @@ def respond(message, chat_history):
|
|
| 137 |
return args;
|
| 138 |
}
|
| 139 |
"""
|
| 140 |
-
|
| 141 |
|
| 142 |
if __name__ == "__main__":
|
| 143 |
demo.launch(theme=gr.themes.Base(), css=css)
|
|
|
|
| 104 |
audio_player = gr.Audio(label="System Voice", visible=True, interactive=False)
|
| 105 |
|
| 106 |
# 3. CHAT LAYER (Bottom)
|
| 107 |
+
chatbot = gr.Chatbot(label="DEFRAG // LOG", elem_classes="chat-window")
|
| 108 |
+
msg = gr.Textbox(placeholder="Input System Status...", show_label=False)
|
| 109 |
|
| 110 |
# Hidden Data Bridge
|
| 111 |
+
visual_data = gr.JSON(visible=False)
|
| 112 |
# --- EVENT WIRING ---
|
| 113 |
|
| 114 |
+
def respond(message, chat_history):
|
| 115 |
# Run logic
|
| 116 |
bot_msg, audio, viz_data = chat_interaction(message, chat_history)
|
| 117 |
|
|
|
|
| 121 |
|
| 122 |
return "", chat_history, audio, viz_data
|
| 123 |
|
| 124 |
+
msg.submit(respond, [msg, chatbot], [msg, chatbot, audio_player, visual_data])
|
| 125 |
+
# JS Bridge to update Canvas
|
| 126 |
+
js_bridge = """
|
| 127 |
(args) => {
|
| 128 |
if (window.hexa) {
|
| 129 |
// args = [hex, petals, elem, stability, speaking]
|
|
|
|
| 137 |
return args;
|
| 138 |
}
|
| 139 |
"""
|
| 140 |
+
visual_data.change(None, [visual_data], None, js=js_bridge)
|
| 141 |
|
| 142 |
if __name__ == "__main__":
|
| 143 |
demo.launch(theme=gr.themes.Base(), css=css)
|