Input path: /home/debian/html/nutritwin/output_llm/66065f4c485fa/input.json
Output path: /home/debian/html/nutritwin/output_llm/66065f4c485fa/output.json
Input text:
DB path: __deriveddata__/DerivedObjects/Data/KcalMeDB_fr.sl3
Picto path: __deriveddata__/DerivedObjects/Data/PictoMatcherNetNG_fr.json
Sport grounding path: __deriveddata__/DerivedObjects/Data/DerivedSportMET.json
==================================================================================================================================
Prompt from user:
==================================================================================================================================
=================================================================================> OK
###########################################
# For image extraction, GPT4 is used #
###########################################
==================================== Prompt =============================================
In the image, identify all the foods and the beverages.
For each of them, identify the "name", the "type", the "quantity", if it exists, the "brand" and the "cooking" mode.
"Portions", like "tranche", are quantities.
Ignore what it is not connected to nutrition, beverage or food.
When the "brand" is not specified and the product is very well-known (like "Coca-Cola"), provide the brand name in "brand", otherwise set "brand" to "".
Identify what "type" of food.
Identify the "company" to which the "brand" belongs.
Estimate the "weight" in grams or centiliters for each result.
Identify the time is the current time, map it on the closest case: "petit-déjeuner", "déjeuner", "grignotage" or "dîner".
When the "name" has synonyms, use the most common name, example: "yaourt" is more common than "yogourt".
Format the result for each ingredient of food & beverage in french in JSON in an array of tuples {"name":, "quantity":, "weight":, "cooking":, "brand":, "company":, "type":, "time":, "event": "declaration"}.
=========================================================================================
Image recognition....
------------------------------ LLM Raw response -----------------------------
[
{
"name": "pomme",
"quantity": "1",
"weight": "150",
"cooking": "cru",
"brand": "",
"company": "",
"type": "fruit",
"time": "grignotage",
"event": "declaration"
}
]
-----------------------------------------------------------------------------
----------------- Make it compliant ------------------
[
{
"name": "pomme",
"quantity": "1",
"weight": "150",
"cooking": "cru",
"brand": "",
"company": "",
"type": "fruit",
"time": "grignotage",
"event": "declaration"
}
]
------------------------------------------------------
------------------------ After simplification ------------------------
[ { "name": "pomme", "quantity": "1", "weight": "150", "cooking": "cru", "brand": "", "company": "", "type": "fruit", "time": "grignotage", "event": "declaration" }]
----------------------------------------------------------------------
--------------------------------- LLM result -----------------------------------
{'response': [{'name': 'pomme', 'quantity': '1', 'weight': '150', 'cooking': 'cru', 'brand': '', 'company': '', 'type': 'fruit', 'time': 'grignotage', 'event': 'declaration'}], 'cost': 0.0}
--------------------------------------------------------------------------------
First try:
SELECT V_Name,V_Comment,V_NormName,V_NormComment,V_PackType,V_GTIN,V_ID,V_GlobalCount,V_NormTrademark,V_Trademark,V_NormAggr FROM KCALME_TABLE WHERE V_NormName LIKE '% pomme %' AND (V_NormTrademark = '' OR V_NormTrademark IS NULL)
------------- Found solution (max 10) --------------
Pomme - - - 68414 - - KCA#c9d2ddea97e4a615e9073d59a85ef6a8
Pomme Gala - pulpe, crue - - 0 - - CIQ#e44cf217ae50f34471f78330ee1fd658
Pomme Golden - pulpe, crue - - 0 - - CIQ#997cb9698418689b25b6a29c68717773
Pomme Golden - pulpe et peau, crue - - 0 - - CIQ#d87c09a9ac2671aa7877b0168488a284
Pommes Paille - - - 24 - - KCA#162eb3eba3a245cd58f39afab73c9aad
Pommes au Four - - - 730 - - KCA#59860e4d5cf11e3aefa80625666866c5
Pommes de Pain - - - 0 - - KCA#0078e5ebc4a45eb9c2c612e634f443e5
Pomme de Terre - égouttée - - 26541 - - CIQ#bbc0fd1495ed69b7aadd91d1d9b9ae69
Pomme de Terre - aliment moyen - - 0 - - CIQ#15f690b8140afc79288abfb96a139095
Pomme de Terre - sans peau, crue - - 0 - - CIQ#9d1dc4d850cf0a126428e8235097b299
----------------------------------------------------
--------------------------------- final result -----------------------------------
{'prompt': '', 'intents': ['Identify food in an image'], 'model': 'mistral-large-latest', 'solutions': {'nutrition': [{'name': 'Pomme', 'normName': ' pomme ', 'comment': '', 'normComment': '', 'rank': 68414, 'id': 'KCA#c9d2ddea97e4a615e9073d59a85ef6a8', 'quantity': '1', 'quantityLem': '1', 'pack': ['POM.w200'], 'type': 'fruit', 'gtin': '', 'brand': '', 'time': 'grignotage', 'event': 'declaration', 'serving': 'POM-100', 'posiNormName': 0}], 'activity': []}, 'cputime': 6.872571706771851}
----------------------------------------------------------------------------------
LLM CPU Time: 6.872571706771851