Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,22 +17,27 @@ def chat_logic(message, image_file, history, mode):
|
|
| 17 |
return history, "", None
|
| 18 |
|
| 19 |
if not chimera:
|
| 20 |
-
history.append(
|
| 21 |
return history, "", None
|
| 22 |
|
| 23 |
# 2. Process Request
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
# 3. Format Output
|
| 27 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 28 |
|
| 29 |
-
# 4. Append to History (
|
|
|
|
| 30 |
if image_file:
|
| 31 |
-
|
| 32 |
else:
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
history.append(
|
| 36 |
|
| 37 |
return history, "", None
|
| 38 |
|
|
@@ -47,8 +52,8 @@ with gr.Blocks(title="Axon God Mode", css=custom_css) as demo:
|
|
| 47 |
gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
|
| 48 |
|
| 49 |
with gr.Row():
|
| 50 |
-
#
|
| 51 |
-
chatbot = gr.Chatbot(height=500, elem_id="chatbot"
|
| 52 |
|
| 53 |
with gr.Row():
|
| 54 |
with gr.Column(scale=4):
|
|
@@ -75,5 +80,5 @@ with gr.Blocks(title="Axon God Mode", css=custom_css) as demo:
|
|
| 75 |
)
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|
| 78 |
-
#
|
| 79 |
demo.launch(ssr_mode=False)
|
|
|
|
| 17 |
return history, "", None
|
| 18 |
|
| 19 |
if not chimera:
|
| 20 |
+
history.append([message, "❌ Error: API Keys missing."])
|
| 21 |
return history, "", None
|
| 22 |
|
| 23 |
# 2. Process Request
|
| 24 |
+
try:
|
| 25 |
+
response_text, active_module = chimera.process_request(message, history, mode, image_file)
|
| 26 |
+
except Exception as e:
|
| 27 |
+
response_text = f"Processing Error: {str(e)}"
|
| 28 |
+
active_module = "ERR"
|
| 29 |
|
| 30 |
# 3. Format Output
|
| 31 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 32 |
|
| 33 |
+
# 4. Append to History (Universal List Format)
|
| 34 |
+
# This works on ALL Gradio versions and avoids format crashes.
|
| 35 |
if image_file:
|
| 36 |
+
user_msg = f"[Uploaded Image] {message}"
|
| 37 |
else:
|
| 38 |
+
user_msg = message
|
| 39 |
+
|
| 40 |
+
history.append([user_msg, final_response])
|
| 41 |
|
| 42 |
return history, "", None
|
| 43 |
|
|
|
|
| 52 |
gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
|
| 53 |
|
| 54 |
with gr.Row():
|
| 55 |
+
# No type="..." needed. Defaults to Lists.
|
| 56 |
+
chatbot = gr.Chatbot(height=500, elem_id="chatbot")
|
| 57 |
|
| 58 |
with gr.Row():
|
| 59 |
with gr.Column(scale=4):
|
|
|
|
| 80 |
)
|
| 81 |
|
| 82 |
if __name__ == "__main__":
|
| 83 |
+
# CRITICAL: ssr_mode=False is still needed for Python 3.13 stability
|
| 84 |
demo.launch(ssr_mode=False)
|