MariamHussam commited on
Commit
56e049f
1 Parent(s): 66b0d55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -4,10 +4,11 @@ from pydantic import BaseModel
4
  from llama_cpp import Llama
5
 
6
 
7
- llm = AutoModelForCausalLM.from_pretrained("TowerInstruct-7B-v0.2.Q8_0.gguf",
8
- max_new_tokens = 2084,
9
- threads = 3,
10
- )
 
11
 
12
  #Pydantic object
13
  class validation(BaseModel):
@@ -38,10 +39,4 @@ def translate_zh_to_en(llm, text):
38
  # <|im_start|>assistant
39
  @app.post("/translate")
40
  async def stream(item: validation):
41
- llm = Llama.from_pretrained(
42
- repo_id="TheBloke/TowerInstruct-7B-v0.1-GGUF",
43
- filename="towerinstruct-7b-v0.1.Q5_K_M.gguf",
44
- n_ctx = 4096,
45
- )
46
-
47
  return translate_zh_to_en(llm, item.prompt)
 
4
  from llama_cpp import Llama
5
 
6
 
7
+ llm = Llama.from_pretrained(
8
+ repo_id="TheBloke/TowerInstruct-7B-v0.1-GGUF",
9
+ filename="towerinstruct-7b-v0.1.Q5_K_M.gguf",
10
+ n_ctx = 4096,
11
+ )
12
 
13
  #Pydantic object
14
  class validation(BaseModel):
 
39
  # <|im_start|>assistant
40
  @app.post("/translate")
41
  async def stream(item: validation):
 
 
 
 
 
 
42
  return translate_zh_to_en(llm, item.prompt)