edersonmelo commited on
Commit
6981cab
·
verified ·
1 Parent(s): d857963

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -8,10 +8,11 @@ app = FastAPI()
8
  llm = None
9
 
10
  def start_llm():
 
11
  llm = Llama(model_path="./tinyllama-1.1b-chat.gguf")
12
 
13
-
14
  @app.post("/health")
 
15
  return {"status": "ok"}
16
 
17
  @app.post("/deployllm")
@@ -29,5 +30,4 @@ async def stream(item: dict):
29
 
30
  return llm(prompt, max_tokens=max_tokens, temperature=temperatura)
31
 
32
-
33
- threading.Thread(target=start_llm).start()
 
8
  llm = None
9
 
10
  def start_llm():
11
+ global llm # Adicione esta linha para modificar a variável global
12
  llm = Llama(model_path="./tinyllama-1.1b-chat.gguf")
13
 
 
14
  @app.post("/health")
15
+ def health_check():
16
  return {"status": "ok"}
17
 
18
  @app.post("/deployllm")
 
30
 
31
  return llm(prompt, max_tokens=max_tokens, temperature=temperatura)
32
 
33
+ threading.Thread(target=start_llm).start()