Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -152,53 +152,53 @@ def chat_interface(message, history, agent_cluster, temperature=0.9, max_new_tok
|
|
152 |
active_agents = [agent for agent, is_active in agent_cluster.items() if is_active]
|
153 |
response = generate(message, history, active_agents, temperature, max_new_tokens, top_p, repetition_penalty)
|
154 |
return (message, response)
|
155 |
-
|
156 |
with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
157 |
-
with gr.Row():
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
204 |
demo.queue().launch(debug=True)
|
|
|
152 |
active_agents = [agent for agent, is_active in agent_cluster.items() if is_active]
|
153 |
response = generate(message, history, active_agents, temperature, max_new_tokens, top_p, repetition_penalty)
|
154 |
return (message, response)
|
|
|
155 |
with gr.Blocks(theme='ParityError/Interstellar') as demo:
|
156 |
+
with gr.Row():
|
157 |
+
for agent_name, agent_data in agent_roles.items():
|
158 |
+
gr.Button(agent_name, variant="secondary").click(toggle_agent, inputs=[gr.Button], outputs=[gr.Textbox])
|
159 |
+
gr.Textbox(agent_data["description"], interactive=False)
|
160 |
+
|
161 |
+
with gr.Row():
|
162 |
+
gr.ChatInterface(
|
163 |
+
chat_interface,
|
164 |
+
additional_inputs=[
|
165 |
+
gr.Slider(
|
166 |
+
label="Temperature",
|
167 |
+
value=0.9,
|
168 |
+
minimum=0.0,
|
169 |
+
maximum=1.0,
|
170 |
+
step=0.05,
|
171 |
+
interactive=True,
|
172 |
+
info="Higher values generate more diverse outputs",
|
173 |
+
),
|
174 |
+
gr.Slider(
|
175 |
+
label="Maximum New Tokens",
|
176 |
+
value=2048,
|
177 |
+
minimum=64,
|
178 |
+
maximum=4096,
|
179 |
+
step=64,
|
180 |
+
interactive=True,
|
181 |
+
info="The maximum number of new tokens",
|
182 |
+
),
|
183 |
+
gr.Slider(
|
184 |
+
label="Top-p (Nucleus Sampling)",
|
185 |
+
value=0.90,
|
186 |
+
minimum=0.0,
|
187 |
+
maximum=1,
|
188 |
+
step=0.05,
|
189 |
+
interactive=True,
|
190 |
+
info="Higher values sample more low-probability tokens",
|
191 |
+
),
|
192 |
+
gr.Slider(
|
193 |
+
label="Repetition Penalty",
|
194 |
+
value=1.2,
|
195 |
+
minimum=1.0,
|
196 |
+
maximum=2.0,
|
197 |
+
step=0.05,
|
198 |
+
interactive=True,
|
199 |
+
info="Penalize repeated tokens",
|
200 |
+
)
|
201 |
+
],
|
202 |
+
inputs=[gr.Textbox, gr.Chatbot, get_agent_cluster],
|
203 |
+
)
|
204 |
demo.queue().launch(debug=True)
|