imaginarycrayon423 commited on
Commit
753b040
·
verified ·
1 Parent(s): 5d2a2ff

Update Gradio_UI.py

Browse files
Files changed (1) hide show
  1. Gradio_UI.py +2 -2
Gradio_UI.py CHANGED
@@ -110,12 +110,12 @@ def pull_messages_from_step(
110
 
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
120
  step_footnote += step_duration
121
  step_footnote = f"""<span style="color: #bbbbc2; font-size: 12px;">{step_footnote}</span> """
 
110
 
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") and step_log.input_token_count and 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") and step_log.duration:
119
  step_duration = f" | Duration: {round(float(step_log.duration), 2)}" if step_log.duration else None
120
  step_footnote += step_duration
121
  step_footnote = f"""<span style="color: #bbbbc2; font-size: 12px;">{step_footnote}</span> """