ffreemt commited on
Commit
d1550c6
1 Parent(s): de341fb
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -218,8 +218,11 @@ def bot(history):
218
 
219
  with about_time() as atime: # type: ignore
220
  flag = 1
 
 
221
  prefix = ""
222
  prelude = 0.0
 
223
  then = time.time()
224
 
225
  logger.debug("about to generate")
@@ -239,11 +242,16 @@ def bot(history):
239
  response.append(elm)
240
  history[-1][1] = prefix + "".join(response)
241
  yield history
242
-
 
 
 
 
 
243
  _ = (
244
  f"(time elapsed: {atime.duration_human}, " # type: ignore
245
- f"{prelude/len(user_message):.2f}s/char"
246
- f"{(atime.duration - prelude)/len(''.join(response)):.2f}s/char)" # type: ignore
247
  )
248
 
249
  history[-1][1] = "".join(response) + f"\n{_}"
 
218
 
219
  with about_time() as atime: # type: ignore
220
  flag = 1
221
+
222
+ # to silence pyright
223
  prefix = ""
224
  prelude = 0.0
225
+
226
  then = time.time()
227
 
228
  logger.debug("about to generate")
 
242
  response.append(elm)
243
  history[-1][1] = prefix + "".join(response)
244
  yield history
245
+ temp1 = ""
246
+ if len(user_message) > 0:
247
+ temp1 = f"{prelude/len(user_message):.2f}s/char, "
248
+ temp2 = ""
249
+ if len(''.join(response)) > 0:
250
+ temp2 = f"{(atime.duration - prelude)/len(''.join(response)):.2f}s/char)" # type: ignore
251
  _ = (
252
  f"(time elapsed: {atime.duration_human}, " # type: ignore
253
+ f"{temp1}"
254
+ f"{temp2}"
255
  )
256
 
257
  history[-1][1] = "".join(response) + f"\n{_}"