Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ SYSTEM = (
|
|
| 14 |
"No macros, no calories, no conversational text, no markdown, only valid JSON."
|
| 15 |
)
|
| 16 |
|
| 17 |
-
llm = Llama(model_path=MODEL_PATH, n_ctx=2048, n_threads=
|
| 18 |
app = FastAPI()
|
| 19 |
|
| 20 |
class MealIn(BaseModel):
|
|
@@ -40,7 +40,7 @@ def parse(body: MealIn, authorization: str = Header(default="")):
|
|
| 40 |
out = llm.create_chat_completion(
|
| 41 |
messages=[{"role": "system", "content": SYSTEM},
|
| 42 |
{"role": "user", "content": body.meal}],
|
| 43 |
-
temperature=0, max_tokens=
|
| 44 |
)
|
| 45 |
parsed = extract_json(out["choices"][0]["message"]["content"])
|
| 46 |
if parsed is None:
|
|
|
|
| 14 |
"No macros, no calories, no conversational text, no markdown, only valid JSON."
|
| 15 |
)
|
| 16 |
|
| 17 |
+
llm = Llama(model_path=MODEL_PATH, n_ctx=2048, n_threads=2, chat_format="chatml")
|
| 18 |
app = FastAPI()
|
| 19 |
|
| 20 |
class MealIn(BaseModel):
|
|
|
|
| 40 |
out = llm.create_chat_completion(
|
| 41 |
messages=[{"role": "system", "content": SYSTEM},
|
| 42 |
{"role": "user", "content": body.meal}],
|
| 43 |
+
temperature=0, max_tokens=256, stop=["<|im_end|>"],
|
| 44 |
)
|
| 45 |
parsed = extract_json(out["choices"][0]["message"]["content"])
|
| 46 |
if parsed is None:
|