Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,8 +17,8 @@ def chat_logic(message, image_file, history, mode):
|
|
| 17 |
return history, "", None
|
| 18 |
|
| 19 |
if not chimera:
|
| 20 |
-
#
|
| 21 |
-
history.append(
|
| 22 |
return history, "", None
|
| 23 |
|
| 24 |
# 2. Process Request
|
|
@@ -27,15 +27,15 @@ def chat_logic(message, image_file, history, mode):
|
|
| 27 |
# 3. Format Output
|
| 28 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 29 |
|
| 30 |
-
# 4. Append to History using
|
|
|
|
| 31 |
if image_file:
|
| 32 |
-
# For uploaded images, we just note it in text for now to keep it stable
|
| 33 |
user_msg = f"[Uploaded Image] {message}"
|
| 34 |
else:
|
| 35 |
user_msg = message
|
| 36 |
|
| 37 |
-
|
| 38 |
-
history.append(
|
| 39 |
|
| 40 |
return history, "", None
|
| 41 |
|
|
@@ -45,13 +45,14 @@ body {background-color: #0b0f19; color: #c9d1d9;}
|
|
| 45 |
.gradio-container {font-family: 'IBM Plex Mono', monospace;}
|
| 46 |
"""
|
| 47 |
|
| 48 |
-
|
|
|
|
| 49 |
gr.Markdown("# ⚡ AXON: GOD MODE")
|
| 50 |
gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
-
#
|
| 54 |
-
chatbot = gr.Chatbot(height=500, elem_id="chatbot"
|
| 55 |
|
| 56 |
with gr.Row():
|
| 57 |
with gr.Column(scale=4):
|
|
@@ -79,4 +80,5 @@ with gr.Blocks(title="Axon God Mode", css=custom_css) as demo:
|
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
# CRITICAL FIX: ssr_mode=False (Fixes the asyncio crash)
|
| 82 |
-
|
|
|
|
|
|
| 17 |
return history, "", None
|
| 18 |
|
| 19 |
if not chimera:
|
| 20 |
+
# Classic Format: [User Message, Bot Message]
|
| 21 |
+
history.append([message, "❌ Error: API Keys missing."])
|
| 22 |
return history, "", None
|
| 23 |
|
| 24 |
# 2. Process Request
|
|
|
|
| 27 |
# 3. Format Output
|
| 28 |
final_response = f"**[{active_module} Active]**\n\n{response_text}"
|
| 29 |
|
| 30 |
+
# 4. Append to History using CLASSIC LISTS
|
| 31 |
+
# This format works on ALL versions of Gradio.
|
| 32 |
if image_file:
|
|
|
|
| 33 |
user_msg = f"[Uploaded Image] {message}"
|
| 34 |
else:
|
| 35 |
user_msg = message
|
| 36 |
|
| 37 |
+
# CRITICAL FIX: Appending a List [User, AI], NOT a Dictionary
|
| 38 |
+
history.append([user_msg, final_response])
|
| 39 |
|
| 40 |
return history, "", None
|
| 41 |
|
|
|
|
| 45 |
.gradio-container {font-family: 'IBM Plex Mono', monospace;}
|
| 46 |
"""
|
| 47 |
|
| 48 |
+
# Removed 'css' from constructor to fix warning
|
| 49 |
+
with gr.Blocks(title="Axon God Mode") as demo:
|
| 50 |
gr.Markdown("# ⚡ AXON: GOD MODE")
|
| 51 |
gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
|
| 52 |
|
| 53 |
with gr.Row():
|
| 54 |
+
# CRITICAL FIX: Removed type="messages" (This was causing the crash)
|
| 55 |
+
chatbot = gr.Chatbot(height=500, elem_id="chatbot")
|
| 56 |
|
| 57 |
with gr.Row():
|
| 58 |
with gr.Column(scale=4):
|
|
|
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
| 82 |
# CRITICAL FIX: ssr_mode=False (Fixes the asyncio crash)
|
| 83 |
+
# Moved css=custom_css here (Fixes the warning)
|
| 84 |
+
demo.launch(ssr_mode=False, css=custom_css)
|