shivanis14 commited on
Commit
cfe23fd
1 Parent(s): 3dfca76

Update rda.py

Browse files
Files changed (1) hide show
  1. rda.py +2 -7
rda.py CHANGED
@@ -1,4 +1,4 @@
1
- import math
2
 
3
  # Function to scale nutrition values
4
  def scale_nutrition(nutrition_per_serving, user_serving_size):
@@ -42,7 +42,6 @@ def process_nutrition_data(nutrition_per_serving, user_serving_size):
42
  }
43
 
44
  scaled_nutrition = scale_nutrition(nutrition_per_serving, user_serving_size)
45
- print(f"DEBUG : scaled_nutrition : {scaled_nutrition}")
46
  #Example : scaled_nutrition : {'energy': 86.86, 'protein': 1.26, 'carbohydrates': 14.29, 'addedSugars': 5.06, 'dietaryFiber': 0.0,
47
  #'totalFat': 2.74, 'saturatedFat': 1.28, 'monounsaturatedFat': 0.0, 'polyunsaturatedFat': 0.0, 'transFat': 0.0, 'sodium': 52.83}
48
 
@@ -71,12 +70,8 @@ def find_nutrition(data):
71
  scaled_nutrition, percentage_daily_values = process_nutrition_data(nutrition_per_serving, user_serving_size)
72
  print(f"DEBUG : percentage_daily_values : {percentage_daily_values}")
73
 
74
- #rda_analysis = {
75
- # 'scaledNutrition': scaled_nutrition,
76
- # 'percentageDailyValues': percentage_daily_values
77
- #}
78
-
79
  rda_analysis_str = f"Nutrition per serving as percentage of Recommended Dietary Allowance (RDA) is {json.dumps(percentage_daily_values)}"
 
80
  return rda_analysis_str
81
 
82
  except Exception as e:
 
1
+ import math, json
2
 
3
  # Function to scale nutrition values
4
  def scale_nutrition(nutrition_per_serving, user_serving_size):
 
42
  }
43
 
44
  scaled_nutrition = scale_nutrition(nutrition_per_serving, user_serving_size)
 
45
  #Example : scaled_nutrition : {'energy': 86.86, 'protein': 1.26, 'carbohydrates': 14.29, 'addedSugars': 5.06, 'dietaryFiber': 0.0,
46
  #'totalFat': 2.74, 'saturatedFat': 1.28, 'monounsaturatedFat': 0.0, 'polyunsaturatedFat': 0.0, 'transFat': 0.0, 'sodium': 52.83}
47
 
 
70
  scaled_nutrition, percentage_daily_values = process_nutrition_data(nutrition_per_serving, user_serving_size)
71
  print(f"DEBUG : percentage_daily_values : {percentage_daily_values}")
72
 
 
 
 
 
 
73
  rda_analysis_str = f"Nutrition per serving as percentage of Recommended Dietary Allowance (RDA) is {json.dumps(percentage_daily_values)}"
74
+ print(f"DEBUG : rda_analysis_str : {rda_analysis_str}")
75
  return rda_analysis_str
76
 
77
  except Exception as e: