Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,23 +63,22 @@ layer_agent_config_rec = {
|
|
| 63 |
|
| 64 |
|
| 65 |
def stream_response(messages: Iterable[ResponseChunk]):
|
| 66 |
-
layer_outputs = {}
|
| 67 |
-
|
| 68 |
for message in messages:
|
| 69 |
if message['response_type'] == 'intermediate':
|
| 70 |
layer = message['metadata']['layer']
|
| 71 |
if layer not in layer_outputs:
|
| 72 |
layer_outputs[layer] = []
|
| 73 |
layer_outputs[layer].append(message['delta'])
|
| 74 |
-
|
| 75 |
else:
|
| 76 |
# Display accumulated layer outputs
|
| 77 |
for layer, outputs in layer_outputs.items():
|
| 78 |
-
st.
|
|
|
|
| 79 |
for i, output in enumerate(outputs):
|
| 80 |
-
with
|
| 81 |
-
st.write(output)
|
| 82 |
-
|
| 83 |
# Clear layer outputs for the next iteration
|
| 84 |
layer_outputs = {}
|
| 85 |
|
|
|
|
| 63 |
|
| 64 |
|
| 65 |
def stream_response(messages: Iterable[ResponseChunk]):
|
| 66 |
+
layer_outputs = {}
|
|
|
|
| 67 |
for message in messages:
|
| 68 |
if message['response_type'] == 'intermediate':
|
| 69 |
layer = message['metadata']['layer']
|
| 70 |
if layer not in layer_outputs:
|
| 71 |
layer_outputs[layer] = []
|
| 72 |
layer_outputs[layer].append(message['delta'])
|
|
|
|
| 73 |
else:
|
| 74 |
# Display accumulated layer outputs
|
| 75 |
for layer, outputs in layer_outputs.items():
|
| 76 |
+
st.write(f"Layer {layer}")
|
| 77 |
+
cols = st.columns(len(outputs))
|
| 78 |
for i, output in enumerate(outputs):
|
| 79 |
+
with cols[i]:
|
| 80 |
+
st.expander(label=f"Agent {i+1}", expanded=False).write(output)
|
| 81 |
+
|
| 82 |
# Clear layer outputs for the next iteration
|
| 83 |
layer_outputs = {}
|
| 84 |
|