ffreemt commited on
Commit
a5bfd0c
1 Parent(s): 1edf218
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -7,8 +7,8 @@ import random
7
  import time
8
  from dataclasses import asdict, dataclass
9
  from pathlib import Path
10
- from types import SimpleNamespace
11
 
 
12
  import gradio as gr
13
  import psutil
14
  from about_time import about_time
@@ -101,7 +101,7 @@ stop_string = [elm.split(":")[0] + ":" for elm in _][-2]
101
 
102
  logger.debug(f"{stop_string=}")
103
 
104
- _ = psutil.cpu_count(logical=False)
105
  cpu_count: int = int(_) if _ else 1
106
  logger.debug(f"{cpu_count=}")
107
 
@@ -128,11 +128,12 @@ except Exception:
128
  # Windows
129
  logger.warning("Windows, cant run time.tzset()")
130
 
 
131
  ns = SimpleNamespace(
132
  response="",
133
  generator=(_ for _ in []),
134
  )
135
-
136
 
137
  @dataclass
138
  class GenerationConfig:
@@ -181,7 +182,6 @@ def bot_(history):
181
  history[-1][1] = ""
182
  for character in bot_message:
183
  history[-1][1] += character
184
- ns.buff = history[-1][1]
185
  time.sleep(0.02)
186
  yield history
187
 
@@ -217,7 +217,7 @@ def bot(history):
217
 
218
  _ = (
219
  f"(time elapsed: {atime.duration_human}, " # type: ignore
220
- f"{atime.duration/len(''.join(response)):.1f}s/char)" # type: ignore
221
  )
222
 
223
  history[-1][1] = "".join(response) + f"\n{_}"
 
7
  import time
8
  from dataclasses import asdict, dataclass
9
  from pathlib import Path
 
10
 
11
+ # from types import SimpleNamespace
12
  import gradio as gr
13
  import psutil
14
  from about_time import about_time
 
101
 
102
  logger.debug(f"{stop_string=}")
103
 
104
+ _ = psutil.cpu_count(logical=False) - 1
105
  cpu_count: int = int(_) if _ else 1
106
  logger.debug(f"{cpu_count=}")
107
 
 
128
  # Windows
129
  logger.warning("Windows, cant run time.tzset()")
130
 
131
+ _ = """
132
  ns = SimpleNamespace(
133
  response="",
134
  generator=(_ for _ in []),
135
  )
136
+ # """
137
 
138
  @dataclass
139
  class GenerationConfig:
 
182
  history[-1][1] = ""
183
  for character in bot_message:
184
  history[-1][1] += character
 
185
  time.sleep(0.02)
186
  yield history
187
 
 
217
 
218
  _ = (
219
  f"(time elapsed: {atime.duration_human}, " # type: ignore
220
+ f"{atime.duration/len(''.join(response)):.2f}s/char)" # type: ignore
221
  )
222
 
223
  history[-1][1] = "".join(response) + f"\n{_}"