implemented side bar panel, main pannel and all the board.
Browse files
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 |
-
|
| 25 |
-
|
| 26 |
-
'Item 3': "This is the content for Item 3"
|
| 27 |
-
}
|
| 28 |
|
| 29 |
# Display expanders for each item
|
| 30 |
-
for
|
| 31 |
-
with st.sidebar.expander(
|
| 32 |
-
st.write(content[
|
| 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?
|
| 81 |
-
highest
|
| 82 |
-
|
| 83 |
-
['
|
| 84 |
LLMResult = askGPT(prompt)
|
| 85 |
lystOfRecipes = LLMResult.split('\n\n')
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
|
|
|
| 89 |
for item in items:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
with st.expander(item["title"]):
|
| 91 |
-
st.write(item[
|
| 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 |
|