Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
0a78c04
1
Parent(s):
442b638
Fix divide by zero
Browse files
app.py
CHANGED
|
@@ -165,11 +165,15 @@ def bot(history):
|
|
| 165 |
response.append(elm)
|
| 166 |
history[-1][1] = prefix + "".join(response)
|
| 167 |
yield history
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
|
| 174 |
history[-1][1] = "".join(response) + f"\n{_}"
|
| 175 |
yield history
|
|
|
|
| 165 |
response.append(elm)
|
| 166 |
history[-1][1] = prefix + "".join(response)
|
| 167 |
yield history
|
| 168 |
+
if response:
|
| 169 |
+
_ = (
|
| 170 |
+
f"(time elapsed: {atime.duration_human}, " # type: ignore
|
| 171 |
+
f"{atime.duration/len(''.join(response)):.2f}s/char)" # type: ignore
|
| 172 |
+
)
|
| 173 |
+
else:
|
| 174 |
+
_ = (
|
| 175 |
+
f"(time elapsed: {atime.duration_human})" # type: ignore
|
| 176 |
+
)
|
| 177 |
|
| 178 |
history[-1][1] = "".join(response) + f"\n{_}"
|
| 179 |
yield history
|