sintuk commited on
Commit
4a7c29a
·
verified ·
1 Parent(s): e86f8ec

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +6 -1
Gradio_UI.py CHANGED
@@ -150,7 +150,12 @@ def stream_to_gradio(
150
  # Handle the case where it's None, for example, by assuming a default value of 0
151
  total_input_tokens += 0
152
 
153
- total_output_tokens += agent.model.last_output_token_count
 
 
 
 
 
154
  if isinstance(step_log, ActionStep):
155
  step_log.input_token_count = agent.model.last_input_token_count
156
  step_log.output_token_count = agent.model.last_output_token_count
 
150
  # Handle the case where it's None, for example, by assuming a default value of 0
151
  total_input_tokens += 0
152
 
153
+ # total_output_tokens += agent.model.last_output_token_count
154
+ if agent.model.last_output_token_count is not None:
155
+ total_output_tokens += agent.model.last_output_token_count
156
+ else:
157
+ # Handle the case where it's None, for example, by assuming a default value of 0
158
+ total_output_tokens += 0
159
  if isinstance(step_log, ActionStep):
160
  step_log.input_token_count = agent.model.last_input_token_count
161
  step_log.output_token_count = agent.model.last_output_token_count