CoolFace
Modelpublic

Turhan123/astra-meal-parser-gguf

sourceHugging Faceotherupdated 3mo agoView on Hugging Face
0likes25downloads
Model Card

🥗 Astra Meal Parser — GGUF

Quantized GGUF builds of a meal-parsing model that reads a free-text meal description in Turkish or English and returns a structured list of food items and their amounts. The model only parses; calories and macros are computed downstream from a nutrition table + calculator (see the full model card for the design).

Available files

FileBaseSizeLicenseNotes
astra-meal-parser-1.5b-q4_k_m.ggufQwen2.5-1.5B~1.0 GBApache 2.0Recommended / deployed — faster on CPU, trained on the expanded dataset
astra-meal-parser-q4_k_m.ggufQwen2.5-3B~1.9 GBQwen ResearchLegacy / archive

The 1.5B build is the recommended one: it is roughly twice as fast on CPU and matches or exceeds the 3B build in accuracy while covering a larger food set.

Evaluation (1.5B)

Held-out set of 149 meal descriptions (TR / EN / mixed), zero overlap with training. Parsing scores the model output; nutrition metrics reflect the full pipeline (parser + 144-food nutrition table + calculator).

MetricValue
Item Precision / Recall / F1100% / 99% / 99%
Parse failures0 / 149
Calorie MAPE1.9%
Protein / Carbs / Fat MAE0.3 g / 1.0 g / 0.3 g

Calorie MAPE by language: Turkish 2.2%, English 1.6%, Mixed 1.1%.

Output format

json
{"items": [{"name": "string", "amount": "string"}]}

No prose, no markdown, no macros.

System prompt

You are a meal parser. Extract every food item and its amount from the user's meal
description (Turkish or English). Return ONLY a strict JSON object of the form
{"items": [{"name": string, "amount": string}]}. No macros, no calories, no
conversational text, no markdown, only valid JSON.

Usage

Ollama

FROM ./astra-meal-parser-1.5b-q4_k_m.gguf

TEMPLATE """{{ if .System }}<|im_start|>system
{{ .System }}<|im_end|>
{{ end }}{{ if .Prompt }}<|im_start|>user
{{ .Prompt }}<|im_end|>
{{ end }}<|im_start|>assistant
{{ .Response }}<|im_end|>
"""

SYSTEM """You are a meal parser. Extract every food item and its amount from the user's meal description (Turkish or English). Return ONLY a strict JSON object of the form {"items": [{"name": string, "amount": string}]}. No macros, no calories, no conversational text, no markdown, only valid JSON."""

PARAMETER temperature 0
PARAMETER stop "<|im_end|>"
bash
ollama create astra-parser -f Modelfile
ollama run astra-parser "2 yumurta, 100g tavuk göğsü ve 1 muz"

llama.cpp

bash
huggingface-cli download Turhan123/astra-meal-parser-gguf \
  astra-meal-parser-1.5b-q4_k_m.gguf --local-dir .

llama-server -m astra-meal-parser-1.5b-q4_k_m.gguf -c 2048

llama-cpp-python

python
from llama_cpp import Llama

llm = Llama(model_path="astra-meal-parser-1.5b-q4_k_m.gguf", n_ctx=2048, chat_format="chatml")

SYSTEM = (
    "You are a meal parser. Extract every food item and its amount from the user's "
    "meal description (Turkish or English). Return ONLY a strict JSON object of the form "
    '{"items": [{"name": string, "amount": string}]}. '
    "No macros, no calories, no conversational text, no markdown, only valid JSON."
)

out = llm.create_chat_completion(
    messages=[{"role": "system", "content": SYSTEM},
              {"role": "user", "content": "2 yumurta, 100g tavuk göğsü ve 1 muz"}],
    temperature=0, max_tokens=256, stop=["<|im_end|>"],
)
print(out["choices"][0]["message"]["content"])

Limitations

Parsing only — calorie/macro accuracy depends on the accompanying nutrition table and calculator. Vague portions are resolved with default serving sizes. See the full model card for the complete list.

License