Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files- Gradio_UI.py +6 -6
Gradio_UI.py
CHANGED
@@ -142,13 +142,13 @@ def stream_to_gradio(
|
|
142 |
for step_log in agent.run(task, stream=True, reset=reset_agent_memory, additional_args=additional_args):
|
143 |
# Track tokens if model provides them
|
144 |
if hasattr(agent.model, "last_input_token_count"):
|
145 |
-
token_count = agent.model.last_input_token_count or 0
|
146 |
-
total_input_tokens += token_count
|
147 |
-
|
148 |
|
149 |
-
|
150 |
-
if agent.model.last_output_token_count is not None:
|
151 |
-
|
152 |
|
153 |
if isinstance(step_log, ActionStep):
|
154 |
step_log.input_token_count = agent.model.last_input_token_count
|
|
|
142 |
for step_log in agent.run(task, stream=True, reset=reset_agent_memory, additional_args=additional_args):
|
143 |
# Track tokens if model provides them
|
144 |
if hasattr(agent.model, "last_input_token_count"):
|
145 |
+
# token_count = agent.model.last_input_token_count or 0
|
146 |
+
# total_input_tokens += token_count
|
147 |
+
total_input_tokens += agent.model.last_input_token_count
|
148 |
|
149 |
+
total_output_tokens += agent.model.last_output_token_count
|
150 |
+
# if agent.model.last_output_token_count is not None:
|
151 |
+
# total_output_tokens += agent.model.last_output_token_count
|
152 |
|
153 |
if isinstance(step_log, ActionStep):
|
154 |
step_log.input_token_count = agent.model.last_input_token_count
|