Daniel Marques commited on
Commit
ee52019
1 Parent(s): 5873d33

fix: add websocketClient

Browse files
Files changed (2) hide show
  1. load_models.py +1 -1
  2. main.py +1 -3
load_models.py CHANGED
@@ -69,7 +69,7 @@ def load_quantized_model_gguf_ggml(model_id, model_basename, device_type, loggin
69
  kwargs["stream"] = stream
70
 
71
  if stream == True:
72
- kwargs["callbacks"] = [StreamingStdOutCallbackHandler()]
73
 
74
  return LlamaCpp(**kwargs)
75
  except:
 
69
  kwargs["stream"] = stream
70
 
71
  if stream == True:
72
+ kwargs["callbacks"] = callbacks
73
 
74
  return LlamaCpp(**kwargs)
75
  except:
main.py CHANGED
@@ -31,15 +31,13 @@ class Predict(BaseModel):
31
  class Delete(BaseModel):
32
  filename: str
33
 
34
- tokenWS = ''
35
-
36
  class MyCustomHandler(BaseCallbackHandler):
37
  def on_llm_new_token(self, token: str, **kwargs) -> None:
38
  global websocketClient
39
 
40
  websocketClient.send_text(f"Message text was: {token}")
41
 
42
- print(f" token: {tokenWS}")
43
 
44
  async def on_llm_start(
45
  self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any
 
31
  class Delete(BaseModel):
32
  filename: str
33
 
 
 
34
  class MyCustomHandler(BaseCallbackHandler):
35
  def on_llm_new_token(self, token: str, **kwargs) -> None:
36
  global websocketClient
37
 
38
  websocketClient.send_text(f"Message text was: {token}")
39
 
40
+ print(f" token: {token}")
41
 
42
  async def on_llm_start(
43
  self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any