sherpal25 commited on
Commit
0143ba0
·
1 Parent(s): 3049c47

implemented side bar panel, main pannel and all the board.

Browse files
Files changed (1) hide show
  1. index.py +20 -18
index.py CHANGED
@@ -14,22 +14,20 @@ def main():
14
  st.sidebar.header('Ingredients & Nutrition')
15
 
16
  # List of items
17
- items = ['Item 1', 'Item 2', 'Item 3']
18
 
19
  #list to of Ingredients camptured
20
  ingredientsList =["apple", "orange", "mango", "potato", "cabbage", "carrot", "lentils"] #list()
21
 
22
  # Define content for each item
23
- content = {
24
- 'Item 1': "This is the content for Item 1",
25
- 'Item 2': "This is the content for Item 2",
26
- 'Item 3': "This is the content for Item 3"
27
- }
28
 
29
  # Display expanders for each item
30
- for item in items:
31
- with st.sidebar.expander(item):
32
- st.write(content[item])
33
 
34
 
35
  # Create a VideoCapture object to access the webcam
@@ -56,7 +54,6 @@ def main():
56
  button_clicked = st.sidebar.button('Done')
57
  if button_clicked:
58
  displayRecipes(ingredientsList)
59
- print(ingredientsList)
60
 
61
  while True:
62
  # Read a frame from the webcam
@@ -77,18 +74,23 @@ def displayRecipes(ingredientsList):
77
  items = []
78
  #now we are gonna send the ingredient list to ask gpt
79
  prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
80
- Ingredients? give me possible list of recipes with Nutrition Facts per 100g from \
81
- highest nutrition value to lowest. Give me results in \
82
- followig format:\
83
- ['title': 'Recipe title', 'content': 'recipe and nutritional facts per 100g']"
84
  LLMResult = askGPT(prompt)
85
  lystOfRecipes = LLMResult.split('\n\n')
86
- for recipe in range(1, len(lystOfRecipes)-1):
87
- items.append({"title": f"Recipe {recipe}", "content": lystOfRecipes[recipe]})
88
- # Display the items with expanding boxes
 
89
  for item in items:
 
 
 
 
90
  with st.expander(item["title"]):
91
- st.write(item["content"])
92
 
93
 
94
 
 
14
  st.sidebar.header('Ingredients & Nutrition')
15
 
16
  # List of items
17
+ #items = ['Item 1', 'Item 2', 'Item 3']
18
 
19
  #list to of Ingredients camptured
20
  ingredientsList =["apple", "orange", "mango", "potato", "cabbage", "carrot", "lentils"] #list()
21
 
22
  # Define content for each item
23
+ content = {}
24
+ for ingredient in ingredientsList:
25
+ content[ingredient] = askGPT(f"Give me your estimate the calories, grams of sugar, grams of fat, and grams of carbohydrates per 100g of {ingredient} as a list")
 
 
26
 
27
  # Display expanders for each item
28
+ for ingredient in ingredientsList:
29
+ with st.sidebar.expander(ingredient):
30
+ st.write(content[ingredient])
31
 
32
 
33
  # Create a VideoCapture object to access the webcam
 
54
  button_clicked = st.sidebar.button('Done')
55
  if button_clicked:
56
  displayRecipes(ingredientsList)
 
57
 
58
  while True:
59
  # Read a frame from the webcam
 
74
  items = []
75
  #now we are gonna send the ingredient list to ask gpt
76
  prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
77
+ Ingredients? Give me A list of detailed recipes with measurements containing these ingredients with Nutrition Facts per 100g based on the widely accepted nutritional value of each of these ingredients. Rank the list from \
78
+ highest nutritional value to lowest. Give me results in \
79
+ following format and do not deviate from this format:\
80
+ ['Recipe title', 'content of recipe and nutritional facts per 100g']. Only give me the list. Do not add commentary or personalized responses."
81
  LLMResult = askGPT(prompt)
82
  lystOfRecipes = LLMResult.split('\n\n')
83
+ print(lystOfRecipes)
84
+ for recipe in range(1,len(lystOfRecipes)-1):
85
+ items.append({"title": lystOfRecipes[recipe].split(":")[0], "content": ""})
86
+ # Display the items with =expanding boxes
87
  for item in items:
88
+ #for side bar's item
89
+ #with st.sidebar.expander(item):
90
+ #st.write("man-holding-banana.jpeg")
91
+ #main page items
92
  with st.expander(item["title"]):
93
+ st.write(askGPT(f"Give me a detailed recipe for a dish called {item['title']} containing all of the following ingredients: {','.join(ingredientsList)}. Make sure your response is easy to follow and comprehensive."))
94
 
95
 
96