dschandra commited on
Commit
40c598d
·
verified ·
1 Parent(s): 0ddbca6

Create portion_size_analysis.py

Browse files
Files changed (1) hide show
  1. portion_size_analysis.py +17 -0
portion_size_analysis.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ def estimate_portion_size(image):
4
+ """
5
+ Estimate the portion size based on the size of bowls/plates in the image.
6
+ """
7
+ # Assume some logic to detect the size of the plate/bowl
8
+ # For simplicity, hardcoded bowl size detection based on image width
9
+ width, height = image.size
10
+ avg_dimension = (width + height) // 2
11
+
12
+ if avg_dimension < 300:
13
+ return "Small (1 person)"
14
+ elif avg_dimension < 600:
15
+ return "Medium (1-2 people)"
16
+ else:
17
+ return "Large (2-4 people)"