Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,8 +10,9 @@ except Exception as e:
|
|
| 10 |
|
| 11 |
def generate_response(message, history, mode_selection):
|
| 12 |
"""
|
| 13 |
-
ChatInterface
|
| 14 |
-
|
|
|
|
| 15 |
"""
|
| 16 |
if not chimera:
|
| 17 |
return "β Error: API Keys missing. Check Settings -> Secrets."
|
|
@@ -23,10 +24,10 @@ def generate_response(message, history, mode_selection):
|
|
| 23 |
"π¬ SFE (Data/Science)": "SFE",
|
| 24 |
"π¨ CSM (Story/Creative)": "CSM"
|
| 25 |
}
|
| 26 |
-
#
|
| 27 |
selected_role = role_map.get(mode_selection, "Auto")
|
| 28 |
|
| 29 |
-
# Get response
|
| 30 |
response_text, active_module = chimera.process_request(message, history, selected_role)
|
| 31 |
|
| 32 |
# Return formatted string
|
|
@@ -38,23 +39,23 @@ body {background-color: #0b0f19; color: #c9d1d9;}
|
|
| 38 |
.gradio-container {font-family: 'IBM Plex Mono', monospace;}
|
| 39 |
"""
|
| 40 |
|
| 41 |
-
#
|
| 42 |
-
with gr.Blocks(
|
| 43 |
gr.Markdown("# βοΈ AXON: QWEN TRINITY")
|
| 44 |
|
| 45 |
-
# The Mode Selector
|
| 46 |
mode_picker = gr.Dropdown(
|
| 47 |
choices=["Auto (Router)", "β‘ ASM (Qwen + Llama)", "π¬ SFE (Data/Science)", "π¨ CSM (Story/Creative)"],
|
| 48 |
value="Auto (Router)",
|
| 49 |
label="Persona Mode"
|
| 50 |
)
|
| 51 |
|
| 52 |
-
#
|
|
|
|
| 53 |
chat = gr.ChatInterface(
|
| 54 |
fn=generate_response,
|
| 55 |
-
additional_inputs=[mode_picker]
|
| 56 |
-
type="messages" # Trying the modern format one last time, safely
|
| 57 |
)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
-
|
|
|
|
|
|
| 10 |
|
| 11 |
def generate_response(message, history, mode_selection):
|
| 12 |
"""
|
| 13 |
+
Standard ChatInterface logic.
|
| 14 |
+
Accepts: message (str), history (list of lists), mode_selection (str)
|
| 15 |
+
Returns: response (str)
|
| 16 |
"""
|
| 17 |
if not chimera:
|
| 18 |
return "β Error: API Keys missing. Check Settings -> Secrets."
|
|
|
|
| 24 |
"π¬ SFE (Data/Science)": "SFE",
|
| 25 |
"π¨ CSM (Story/Creative)": "CSM"
|
| 26 |
}
|
| 27 |
+
# Handle case where mode is None
|
| 28 |
selected_role = role_map.get(mode_selection, "Auto")
|
| 29 |
|
| 30 |
+
# Get response from Chimera Brain
|
| 31 |
response_text, active_module = chimera.process_request(message, history, selected_role)
|
| 32 |
|
| 33 |
# Return formatted string
|
|
|
|
| 39 |
.gradio-container {font-family: 'IBM Plex Mono', monospace;}
|
| 40 |
"""
|
| 41 |
|
| 42 |
+
# 1. Removed 'css' from Blocks to fix the Warning
|
| 43 |
+
with gr.Blocks(title="Axon Trinity") as demo:
|
| 44 |
gr.Markdown("# βοΈ AXON: QWEN TRINITY")
|
| 45 |
|
|
|
|
| 46 |
mode_picker = gr.Dropdown(
|
| 47 |
choices=["Auto (Router)", "β‘ ASM (Qwen + Llama)", "π¬ SFE (Data/Science)", "π¨ CSM (Story/Creative)"],
|
| 48 |
value="Auto (Router)",
|
| 49 |
label="Persona Mode"
|
| 50 |
)
|
| 51 |
|
| 52 |
+
# 2. REMOVED 'type="messages"' completely.
|
| 53 |
+
# This forces it to use the default 'List of Lists' format which never crashes.
|
| 54 |
chat = gr.ChatInterface(
|
| 55 |
fn=generate_response,
|
| 56 |
+
additional_inputs=[mode_picker]
|
|
|
|
| 57 |
)
|
| 58 |
|
| 59 |
if __name__ == "__main__":
|
| 60 |
+
# 3. Moved CSS here and disabled SSR for safety
|
| 61 |
+
demo.launch(ssr_mode=False, css=custom_css)
|