AIencoder commited on
Commit
70f515f
Β·
verified Β·
1 Parent(s): 3a64534

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -28
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from src.chimera_core import Chimera
3
 
4
- # Initialize the Beast
5
  try:
6
  chimera = Chimera()
7
  except Exception as e:
@@ -10,14 +10,13 @@ except Exception as e:
10
 
11
  def chat_logic(message, history, mode_selection):
12
  if not chimera:
13
- # Error handling also needs to be a dictionary now
14
- history.append({"role": "assistant", "content": "❌ Error: API Key missing. Check Settings -> Secrets."})
15
  return history, ""
16
 
17
- # Map friendly names to internal codes
18
  role_map = {
19
  "Auto (Router)": "Auto",
20
- "πŸ‘¨β€πŸ’» ASM (Coder)": "ASM",
21
  "πŸ”¬ SFE (Scientist)": "SFE",
22
  "🎨 CSM (Writer)": "CSM"
23
  }
@@ -26,50 +25,35 @@ def chat_logic(message, history, mode_selection):
26
  # Get response
27
  response_text, active_module = chimera.process_request(message, history, selected_role)
28
 
29
- # Format the output with the active module tag
30
  final_response = f"**[{active_module} Active]**\n\n{response_text}"
31
 
32
- # --- THE FIX IS HERE ---
33
- # Instead of history.append((message, final_response)), we do this:
34
  history.append({"role": "user", "content": message})
35
  history.append({"role": "assistant", "content": final_response})
36
 
37
  return history, ""
38
 
39
- # --- Sci-Fi Theme CSS ---
40
  custom_css = """
41
  body {background-color: #0b0f19; color: #c9d1d9;}
42
  .gradio-container {font-family: 'IBM Plex Mono', monospace;}
43
- header {display: none !important;}
44
- #chatbot {
45
- height: 600px;
46
- border: 1px solid #30363d;
47
- background-color: #0d1117;
48
- border-radius: 12px;
49
- }
50
- .feedback {font-size: 12px; color: #8b949e;}
51
  """
52
 
53
- with gr.Blocks(css=custom_css, title="Project Chimera") as demo:
54
- gr.Markdown("# 🦁 Project Chimera")
55
- gr.Markdown("*> Multi-Persona Routing System // Online*")
56
 
57
  with gr.Row():
58
  with gr.Column(scale=4):
59
  chatbot = gr.Chatbot(elem_id="chatbot", type="messages")
60
-
61
  with gr.Column(scale=1):
62
- gr.Markdown("### βš™οΈ System Controls")
63
  mode = gr.Dropdown(
64
- choices=["Auto (Router)", "πŸ‘¨β€πŸ’» ASM (Coder)", "πŸ”¬ SFE (Scientist)", "🎨 CSM (Writer)"],
65
  value="Auto (Router)",
66
- label="Persona Mode",
67
- interactive=True
68
  )
69
- gr.Markdown("*Select 'Auto' to let the AI decide, or force a specific module.*")
70
 
71
- msg = gr.Textbox(placeholder="Enter command or query...", autofocus=True, label="User Input")
72
-
73
  msg.submit(chat_logic, [msg, chatbot, mode], [chatbot, msg])
74
 
75
  if __name__ == "__main__":
 
1
  import gradio as gr
2
  from src.chimera_core import Chimera
3
 
4
+ # Initialize
5
  try:
6
  chimera = Chimera()
7
  except Exception as e:
 
10
 
11
  def chat_logic(message, history, mode_selection):
12
  if not chimera:
13
+ history.append({"role": "assistant", "content": "❌ Error: API Keys missing. Check Settings -> Secrets."})
 
14
  return history, ""
15
 
16
+ # Map friendly names
17
  role_map = {
18
  "Auto (Router)": "Auto",
19
+ "⚑ ASM (Dual-Core Code)": "ASM",
20
  "πŸ”¬ SFE (Scientist)": "SFE",
21
  "🎨 CSM (Writer)": "CSM"
22
  }
 
25
  # Get response
26
  response_text, active_module = chimera.process_request(message, history, selected_role)
27
 
28
+ # Format output
29
  final_response = f"**[{active_module} Active]**\n\n{response_text}"
30
 
 
 
31
  history.append({"role": "user", "content": message})
32
  history.append({"role": "assistant", "content": final_response})
33
 
34
  return history, ""
35
 
 
36
  custom_css = """
37
  body {background-color: #0b0f19; color: #c9d1d9;}
38
  .gradio-container {font-family: 'IBM Plex Mono', monospace;}
39
+ #chatbot {height: 600px; border: 1px solid #30363d; background-color: #0d1117;}
 
 
 
 
 
 
 
40
  """
41
 
42
+ with gr.Blocks(css=custom_css, title="Axon Dual-Core") as demo:
43
+ gr.Markdown("# βš”οΈ AXON: DUAL-CORE")
44
+ gr.Markdown("*> Pipeline: Gemini 2.5 (Draft) βž” GPT-4o (Refine)*")
45
 
46
  with gr.Row():
47
  with gr.Column(scale=4):
48
  chatbot = gr.Chatbot(elem_id="chatbot", type="messages")
 
49
  with gr.Column(scale=1):
 
50
  mode = gr.Dropdown(
51
+ choices=["Auto (Router)", "⚑ ASM (Dual-Core Code)", "πŸ”¬ SFE (Scientist)", "🎨 CSM (Writer)"],
52
  value="Auto (Router)",
53
+ label="Persona Mode"
 
54
  )
 
55
 
56
+ msg = gr.Textbox(placeholder="Enter coding task...", autofocus=True)
 
57
  msg.submit(chat_logic, [msg, chatbot, mode], [chatbot, msg])
58
 
59
  if __name__ == "__main__":