MenuVision-AI / modules /health_ai.py
Wall06's picture
Create modules/health_ai.py
ebe706c verified
raw
history blame
888 Bytes
import random
def analyze_health(menu_text):
"""
Analyzes menu text to find allergens and health stats.
"""
menu_text_lower = menu_text.lower()
# Simple keyword analysis for demo purposes
risk_level = "Moderate ⚠️"
if any(x in menu_text_lower for x in ["fried", "sugar", "bacon", "cream"]):
risk_level = "Not Recommended ❌"
elif any(x in menu_text_lower for x in ["salad", "grilled", "steamed", "vegan"]):
risk_level = "Recommended ✅"
insights = {
"Estimated Calorie Range": f"{random.randint(300, 800)} - {random.randint(850, 1500)} kcal",
"Diabetic Friendly": "No" if "sugar" in menu_text_lower else "Yes",
"Heart Health Score": risk_level,
"Potential Allergens": [alg for alg in ["Peanuts", "Gluten", "Dairy", "Shellfish"] if random.choice([True, False])]
}
return insights