Upload 5 files
Browse files- .gitattributes +2 -0
- DejaVuSans.ttf +3 -0
- food_info (1).json +112 -0
- food_vision_model (2).keras +3 -0
- health_logic (1).py +56 -0
- requirements.txt +7 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
DejaVuSans.ttf filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
food_vision_model[[:space:]](2).keras filter=lfs diff=lfs merge=lfs -text
|
DejaVuSans.ttf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:abdc775b21b1bc470d50c97e790d276f2054b7504e56e5bd3e64f48d68582322
|
| 3 |
+
size 759720
|
food_info (1).json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"akara": {
|
| 3 |
+
"display_name": "Akara (Bean Cake)",
|
| 4 |
+
"ethnicity": "Yoruba / Nigeria-wide",
|
| 5 |
+
"ingredients": ["black-eyed beans", "onions", "pepper", "salt", "vegetable oil"],
|
| 6 |
+
"calories": 350,
|
| 7 |
+
"carbs": 30,
|
| 8 |
+
"protein": 12,
|
| 9 |
+
"fat": 20,
|
| 10 |
+
"diet_type": "Vegan",
|
| 11 |
+
"substitute": "Baked bean cakes"
|
| 12 |
+
},
|
| 13 |
+
"banga_soup": {
|
| 14 |
+
"display_name": "Banga Soup",
|
| 15 |
+
"ethnicity": "Niger Delta / Urhobo",
|
| 16 |
+
"ingredients": ["palm fruit extract", "beef", "stockfish", "crayfish", "seasoning"],
|
| 17 |
+
"calories": 500,
|
| 18 |
+
"carbs": 10,
|
| 19 |
+
"protein": 25,
|
| 20 |
+
"fat": 40,
|
| 21 |
+
"diet_type": "Non-vegan",
|
| 22 |
+
"substitute": "Vegetable oil okra soup"
|
| 23 |
+
},
|
| 24 |
+
"egusi_soup": {
|
| 25 |
+
"display_name": "Egusi Soup",
|
| 26 |
+
"ethnicity": "Igbo / Yoruba / Pan-Nigerian",
|
| 27 |
+
"ingredients": ["melon seeds", "vegetable oil", "leafy greens", "meat", "crayfish"],
|
| 28 |
+
"calories": 600,
|
| 29 |
+
"carbs": 12,
|
| 30 |
+
"protein": 28,
|
| 31 |
+
"fat": 45,
|
| 32 |
+
"diet_type": "Non-vegan",
|
| 33 |
+
"substitute": "Pumpkin soup"
|
| 34 |
+
},
|
| 35 |
+
"jollof_rice": {
|
| 36 |
+
"display_name": "Jollof Rice",
|
| 37 |
+
"ethnicity": "West African / Nigeria",
|
| 38 |
+
"ingredients": ["rice", "tomato paste", "vegetable oil", "onion", "pepper"],
|
| 39 |
+
"calories": 450,
|
| 40 |
+
"carbs": 65,
|
| 41 |
+
"protein": 8,
|
| 42 |
+
"fat": 15,
|
| 43 |
+
"diet_type": "Vegan",
|
| 44 |
+
"substitute": "Brown rice with grilled veggies"
|
| 45 |
+
},
|
| 46 |
+
"moi_moi": {
|
| 47 |
+
"display_name": "Moi Moi",
|
| 48 |
+
"ethnicity": "Yoruba / Nigeria-wide",
|
| 49 |
+
"ingredients": ["beans", "pepper", "onions", "oil", "egg (optional)"],
|
| 50 |
+
"calories": 300,
|
| 51 |
+
"carbs": 25,
|
| 52 |
+
"protein": 10,
|
| 53 |
+
"fat": 12,
|
| 54 |
+
"diet_type": "Vegan/Non-vegan",
|
| 55 |
+
"substitute": "Steamed lentil cakes"
|
| 56 |
+
},
|
| 57 |
+
"nkwobi": {
|
| 58 |
+
"display_name": "Nkwobi",
|
| 59 |
+
"ethnicity": "Igbo",
|
| 60 |
+
"ingredients": ["cow foot", "palm oil", "utazi leaves", "seasoning"],
|
| 61 |
+
"calories": 520,
|
| 62 |
+
"carbs": 5,
|
| 63 |
+
"protein": 35,
|
| 64 |
+
"fat": 38,
|
| 65 |
+
"diet_type": "Non-vegan",
|
| 66 |
+
"substitute": "Lean meat pepper soup"
|
| 67 |
+
},
|
| 68 |
+
"okpa": {
|
| 69 |
+
"display_name": "Okpa (Bambara Cake)",
|
| 70 |
+
"ethnicity": "Enugu / Southeastern Nigeria",
|
| 71 |
+
"ingredients": ["bambara nut flour", "pepper", "oil", "salt"],
|
| 72 |
+
"calories": 360,
|
| 73 |
+
"carbs": 40,
|
| 74 |
+
"protein": 15,
|
| 75 |
+
"fat": 18,
|
| 76 |
+
"diet_type": "Vegan",
|
| 77 |
+
"substitute": "Steamed mung bean cake"
|
| 78 |
+
},
|
| 79 |
+
"suya": {
|
| 80 |
+
"display_name": "Suya",
|
| 81 |
+
"ethnicity": "Hausa / Northern Nigeria",
|
| 82 |
+
"ingredients": ["beef", "yaji spice", "oil", "salt"],
|
| 83 |
+
"calories": 480,
|
| 84 |
+
"carbs": 6,
|
| 85 |
+
"protein": 35,
|
| 86 |
+
"fat": 30,
|
| 87 |
+
"diet_type": "Non-vegan",
|
| 88 |
+
"substitute": "Grilled chicken breast with herbs"
|
| 89 |
+
},
|
| 90 |
+
"tuwo": {
|
| 91 |
+
"display_name": "Tuwo Shinkafa",
|
| 92 |
+
"ethnicity": "Hausa / Northern Nigeria",
|
| 93 |
+
"ingredients": ["rice", "water", "salt"],
|
| 94 |
+
"calories": 320,
|
| 95 |
+
"carbs": 70,
|
| 96 |
+
"protein": 5,
|
| 97 |
+
"fat": 1,
|
| 98 |
+
"diet_type": "Vegan",
|
| 99 |
+
"substitute": "Millet flour tuwo"
|
| 100 |
+
},
|
| 101 |
+
"yam_porridge": {
|
| 102 |
+
"display_name": "Yam Porridge",
|
| 103 |
+
"ethnicity": "Yoruba / Nigeria-wide",
|
| 104 |
+
"ingredients": ["yam", "palm oil", "leafy greens", "pepper", "onion"],
|
| 105 |
+
"calories": 400,
|
| 106 |
+
"carbs": 55,
|
| 107 |
+
"protein": 8,
|
| 108 |
+
"fat": 20,
|
| 109 |
+
"diet_type": "Vegan",
|
| 110 |
+
"substitute": "Boiled yam with vegetable sauce"
|
| 111 |
+
}
|
| 112 |
+
}
|
food_vision_model (2).keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:74d84bb819d6372e5140ebd94f18a2aae5c7808a35053a52b7b401b2dc2def7a
|
| 3 |
+
size 46865784
|
health_logic (1).py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def generate_advice(food_info, conditions):
|
| 2 |
+
ingredients = [i.lower() for i in food_info["ingredients"]]
|
| 3 |
+
fat = food_info["fat"]
|
| 4 |
+
calories = food_info["calories"]
|
| 5 |
+
carbs = food_info["carbs"]
|
| 6 |
+
protein = food_info["protein"]
|
| 7 |
+
|
| 8 |
+
risk_score = 0
|
| 9 |
+
flags = []
|
| 10 |
+
advice_parts = []
|
| 11 |
+
|
| 12 |
+
for cond in conditions:
|
| 13 |
+
if cond == "Diabetic":
|
| 14 |
+
if "sugar" in ingredients or carbs > 40:
|
| 15 |
+
risk_score += 30
|
| 16 |
+
flags.append("High carb")
|
| 17 |
+
advice_parts.append("Reduce starchy ingredients or use low-GI substitutes.")
|
| 18 |
+
|
| 19 |
+
if cond == "Hypertensive":
|
| 20 |
+
if "salt" in ingredients:
|
| 21 |
+
risk_score += 20
|
| 22 |
+
flags.append("Salt content")
|
| 23 |
+
advice_parts.append("Avoid adding salt; use natural spices.")
|
| 24 |
+
if fat > 25:
|
| 25 |
+
risk_score += 15
|
| 26 |
+
flags.append("High fat")
|
| 27 |
+
|
| 28 |
+
if cond == "Weight Loss":
|
| 29 |
+
if calories > 400:
|
| 30 |
+
risk_score += 25
|
| 31 |
+
flags.append("High calorie")
|
| 32 |
+
advice_parts.append("Consider smaller portions or reduce oil usage.")
|
| 33 |
+
|
| 34 |
+
if cond == "Malnourished":
|
| 35 |
+
if protein < 10:
|
| 36 |
+
risk_score += 15
|
| 37 |
+
flags.append("Low protein")
|
| 38 |
+
advice_parts.append("Add protein-rich sides like beans or eggs.")
|
| 39 |
+
|
| 40 |
+
if cond == "Pregnant/Nursing":
|
| 41 |
+
if protein < 10:
|
| 42 |
+
risk_score += 10
|
| 43 |
+
flags.append("Low protein for pregnancy")
|
| 44 |
+
advice_parts.append("Increase protein with fish, legumes, or eggs.")
|
| 45 |
+
|
| 46 |
+
if cond == "Cholesterol Watch":
|
| 47 |
+
if "palm oil" in ingredients or fat > 25:
|
| 48 |
+
risk_score += 20
|
| 49 |
+
flags.append("Cholesterol risk")
|
| 50 |
+
advice_parts.append("Avoid palm oil and fried foods.")
|
| 51 |
+
|
| 52 |
+
if not advice_parts:
|
| 53 |
+
advice_parts.append("No major risks detected. Enjoy in moderation.")
|
| 54 |
+
|
| 55 |
+
advice = " ".join(set(advice_parts))
|
| 56 |
+
return advice, min(risk_score, 100), flags
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.28.0
|
| 2 |
+
tensorflow>=2.13.0
|
| 3 |
+
numpy>=1.24.0
|
| 4 |
+
Pillow>=9.5.0
|
| 5 |
+
fpdf2>=2.7.8
|
| 6 |
+
gTTS>=2.3.2
|
| 7 |
+
deep-translator>=1.11.4
|