npc0 commited on
Commit
2aa544e
1 Parent(s): 9ef7b0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -8,9 +8,7 @@ if not os.path.exists(os.getenv("checkpoint_path")):
8
  os.system("git clone --recurse-submodules https://github.com/ztxz16/fastllm.git")
9
  os.system("cd fastllm; mkdir build; cd build; cmake ..; make -j; cd tools; python setup.py install --user --prefix=")
10
  os.system("wget https://huggingface.co/huangyuyang/chatglm2-6b-int4.flm/resolve/main/chatglm2-6b-int4.flm")
11
- my_env = os.environ.copy()
12
- # my_env["PATH"] = f"/usr/sbin:/sbin:{my_env['PATH']}"
13
- subprocess.Popen("uvicorn api:app --reload", env=my_env)
14
 
15
  class GUI:
16
  def __init__(self, *args, **kwargs):
@@ -34,12 +32,13 @@ class GUI:
34
  chapter_titles = epub2txt.content_titles
35
  title = epub2txt.title
36
  if self.ws is None:
37
- self.ws = create_connection(f"ws://localhost:8000/{file.name}/ws")
 
38
  res = ''
39
  while 'output: ' not in res:
40
  res = self.ws.recv()
41
  if 'chsum: ' in res:
42
- self.out.append(res.remove("chsum: "))
43
  elif 'draft_sum: ' in res:
44
  h = res[11:]
45
  elif 'output: ' in res:
 
8
  os.system("git clone --recurse-submodules https://github.com/ztxz16/fastllm.git")
9
  os.system("cd fastllm; mkdir build; cd build; cmake ..; make -j; cd tools; python setup.py install --user --prefix=")
10
  os.system("wget https://huggingface.co/huangyuyang/chatglm2-6b-int4.flm/resolve/main/chatglm2-6b-int4.flm")
11
+ subprocess.Popen("uvicorn", "api:app")
 
 
12
 
13
  class GUI:
14
  def __init__(self, *args, **kwargs):
 
32
  chapter_titles = epub2txt.content_titles
33
  title = epub2txt.title
34
  if self.ws is None:
35
+ self.ws = create_connection(f"ws://localhost:8000/ws")
36
+ self.ws.send(file.name)
37
  res = ''
38
  while 'output: ' not in res:
39
  res = self.ws.recv()
40
  if 'chsum: ' in res:
41
+ self.out.append(res.replace("chsum: ", ""))
42
  elif 'draft_sum: ' in res:
43
  h = res[11:]
44
  elif 'output: ' in res: