AIencoder commited on
Commit
542a475
·
verified ·
1 Parent(s): f9922f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -17,7 +17,6 @@ def chat_logic(message, image_file, history, mode):
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
 
@@ -27,14 +26,14 @@ 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 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
@@ -45,13 +44,12 @@ body {background-color: #0b0f19; color: #c9d1d9;}
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():
@@ -79,6 +77,5 @@ with gr.Blocks(title="Axon God Mode") as demo:
79
  )
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)
 
17
  return history, "", None
18
 
19
  if not chimera:
 
20
  history.append([message, "❌ Error: API Keys missing."])
21
  return history, "", None
22
 
 
26
  # 3. Format Output
27
  final_response = f"**[{active_module} Active]**\n\n{response_text}"
28
 
29
+ # 4. Append to History (Universal List Format)
30
+ # We do NOT use dictionaries. We use simple lists.
31
  if image_file:
32
  user_msg = f"[Uploaded Image] {message}"
33
  else:
34
  user_msg = message
35
 
36
+ # Append as [UserMessage, BotMessage]
37
  history.append([user_msg, final_response])
38
 
39
  return history, "", None
 
44
  .gradio-container {font-family: 'IBM Plex Mono', monospace;}
45
  """
46
 
47
+ with gr.Blocks(title="Axon God Mode", css=custom_css) as demo:
 
48
  gr.Markdown("# ⚡ AXON: GOD MODE")
49
  gr.Markdown("*> Modules: VIM (Vision) | NET (Web) | IGM (Art) | ASM (Code)*")
50
 
51
  with gr.Row():
52
+ # No 'type' argument. Defaults to Lists (Universal)
53
  chatbot = gr.Chatbot(height=500, elem_id="chatbot")
54
 
55
  with gr.Row():
 
77
  )
78
 
79
  if __name__ == "__main__":
80
+ # CRITICAL: Disable SSR to prevent the 'Invalid file descriptor' crash
81
+ demo.launch(ssr_mode=False)