Spaces:
Sleeping
Sleeping
293droid commited on
Commit ·
2ef9c19
1
Parent(s): ddbe441
fix: shea butter parser, superfat display, stop hallucination tokens
Browse files48 unmodified lines49505152525354555613 unmodified lines70717273747374757677787980818283848586878848 unmodified lines {"role": "system", "content": SYSTEM_PROMPT}, {"role": "user", "content": full_prompt} ], max_tokens=800, max_tokens=500, stop=["user ", "User ", "\nuser", "\nUser"], ) return response.choices[0].message.content except Exception as e:13 unmodified lines weight = float(weight_str) oil_fragment = oil_fragment.strip().rstrip(',').strip() matched_key = None # Try exact match first for key in OILS: key_words = key.replace('(', '').replace(')', '').split() if any(word in oil_fragment for word in key_words if len(word) > 3): if key == oil_fragment.strip(): matched_key = key break # Then try word match if not matched_key: for key in OILS: key_words = key.replace('(','').replace(')','').split() scored_words = [w for w in key_words if len(w) > 4 and w not in ["butter","oil","seed","palm"]] if scored_words and all(w in oil_fragment for w in scored_words): matched_key = key break if matched_key and weight > 0: recipe[matched_key] = recipe.get(matched_key, 0) + weight return recipeapp.py+12-3