Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -142,14 +142,14 @@ def run_code(code):
|
|
142 |
|
143 |
def chat_interface(message, history, agent_cluster, temperature=0.9, max_new_tokens=2048, top_p=0.95, repetition_penalty=1.0):
|
144 |
"""Handles user input and generates responses."""
|
145 |
-
if message.startswith("
|
146 |
|
147 |
|
148 |
python"): # User entered code, execute it code = message[9:-3] output = run_code(code) return (message, output) else: # User entered a normal message, generate a response active_agents = [agent for agent, is_active in agent_cluster.items() if is_active] response = generate(message, history, active_agents, temperature, max_new_tokens, top_p, repetition_penalty) return (message, response)
|
149 |
|
150 |
-
with gr.Blocks(theme='ParityError/Interstellar') as demo: with gr.Row(): for agent_name, agent_data in agent_roles.items(): gr.Button(agent_name, variant="secondary").click(toggle_agent, inputs=[gr.Button], outputs=[gr.Textbox]) gr.Textbox(agent_data["description"], interactive=False)
|
151 |
|
152 |
-
with gr.Row(
|
153 |
gr.ChatInterface(
|
154 |
chat_interface,
|
155 |
additional_inputs=[
|
|
|
142 |
|
143 |
def chat_interface(message, history, agent_cluster, temperature=0.9, max_new_tokens=2048, top_p=0.95, repetition_penalty=1.0):
|
144 |
"""Handles user input and generates responses."""
|
145 |
+
if message.startswith("
|
146 |
|
147 |
|
148 |
python"): # User entered code, execute it code = message[9:-3] output = run_code(code) return (message, output) else: # User entered a normal message, generate a response active_agents = [agent for agent, is_active in agent_cluster.items() if is_active] response = generate(message, history, active_agents, temperature, max_new_tokens, top_p, repetition_penalty) return (message, response)
|
149 |
|
150 |
+
with gr.Blocks(theme='ParityError/Interstellar') as demo: with gr.Row(): for agent_name, agent_data in agent_roles.items(): gr.Button(agent_name, variant="secondary").click(toggle_agent, inputs=[gr.Button], outputs=[gr.Textbox]) gr.Textbox(agent_data["description"], interactive=False)
|
151 |
|
152 |
+
with gr.Row(:
|
153 |
gr.ChatInterface(
|
154 |
chat_interface,
|
155 |
additional_inputs=[
|