Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,11 @@ from pydantic import BaseModel
|
|
| 4 |
from llama_cpp import Llama
|
| 5 |
|
| 6 |
|
| 7 |
-
llm =
|
| 8 |
-
|
| 9 |
-
|
| 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)
|