Kackle commited on
Commit
83644cb
·
verified ·
1 Parent(s): 9afc9a8

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +5 -3
Gradio_UI.py CHANGED
@@ -111,9 +111,11 @@ def pull_messages_from_step(
111
  # Calculate duration and token information
112
  step_footnote = f"{step_number}"
113
  if hasattr(step_log, "input_token_count") and hasattr(step_log, "output_token_count"):
114
- token_str = (
115
- f" | Input-tokens:{step_log.input_token_count:,} | Output-tokens:{step_log.output_token_count:,}"
116
- )
 
 
117
  step_footnote += token_str
118
  if hasattr(step_log, "duration"):
119
  step_duration = f" | Duration: {round(float(step_log.duration), 2)}" if step_log.duration else None
 
111
  # Calculate duration and token information
112
  step_footnote = f"{step_number}"
113
  if hasattr(step_log, "input_token_count") and hasattr(step_log, "output_token_count"):
114
+ token_str = ""
115
+ if hasattr(step_log, "input_token_count") and step_log.input_token_count is not None:
116
+ token_str += f" | Input-tokens:{step_log.input_token_count:,}"
117
+ if hasattr(step_log, "output_token_count") and step_log.output_token_count is not None:
118
+ token_str += f" | Output-tokens:{step_log.output_token_count:,}"
119
  step_footnote += token_str
120
  if hasattr(step_log, "duration"):
121
  step_duration = f" | Duration: {round(float(step_log.duration), 2)}" if step_log.duration else None