Merge branch 'main' of https://huggingface.co/threeidots/SpeakClear
Browse files
index.py
CHANGED
|
@@ -18,19 +18,22 @@ def main():
|
|
| 18 |
|
| 19 |
st.sidebar.header('Ingredients & Nutrition')
|
| 20 |
# List of items
|
| 21 |
-
items = ['Item 1', 'Item 2', 'Item 3']
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
# Define content for each item
|
| 24 |
-
content = {
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
'Item 3': "This is the content for Item 3"
|
| 28 |
-
}
|
| 29 |
|
| 30 |
# Display expanders for each item
|
| 31 |
-
for
|
| 32 |
-
with st.sidebar.expander(
|
| 33 |
-
st.write(content[
|
|
|
|
|
|
|
| 34 |
# Create a VideoCapture object to access the webcam
|
| 35 |
cap = cv2.VideoCapture(0)
|
| 36 |
|
|
@@ -78,18 +81,23 @@ def displayRecipes(ingredientsList):
|
|
| 78 |
items = []
|
| 79 |
#now we are gonna send the ingredient list to ask gpt
|
| 80 |
prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
|
| 81 |
-
Ingredients?
|
| 82 |
-
highest
|
| 83 |
-
|
| 84 |
-
['
|
| 85 |
LLMResult = askGPT(prompt)
|
| 86 |
lystOfRecipes = LLMResult.split('\n\n')
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
| 90 |
for item in items:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
with st.expander(item["title"]):
|
| 92 |
-
st.write(item[
|
| 93 |
|
| 94 |
|
| 95 |
def capture_image():
|
|
|
|
| 18 |
|
| 19 |
st.sidebar.header('Ingredients & Nutrition')
|
| 20 |
# List of items
|
| 21 |
+
#items = ['Item 1', 'Item 2', 'Item 3']
|
| 22 |
+
|
| 23 |
+
#list to of Ingredients camptured
|
| 24 |
+
ingredientsList =["apple", "orange", "mango", "potato", "cabbage", "carrot", "lentils"] #list()
|
| 25 |
|
| 26 |
# Define content for each item
|
| 27 |
+
content = {}
|
| 28 |
+
for ingredient in ingredientsList:
|
| 29 |
+
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")
|
|
|
|
|
|
|
| 30 |
|
| 31 |
# Display expanders for each item
|
| 32 |
+
for ingredient in ingredientsList:
|
| 33 |
+
with st.sidebar.expander(ingredient):
|
| 34 |
+
st.write(content[ingredient])
|
| 35 |
+
|
| 36 |
+
|
| 37 |
# Create a VideoCapture object to access the webcam
|
| 38 |
cap = cv2.VideoCapture(0)
|
| 39 |
|
|
|
|
| 81 |
items = []
|
| 82 |
#now we are gonna send the ingredient list to ask gpt
|
| 83 |
prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
|
| 84 |
+
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 \
|
| 85 |
+
highest nutritional value to lowest. Give me results in \
|
| 86 |
+
following format and do not deviate from this format:\
|
| 87 |
+
['Recipe title', 'content of recipe and nutritional facts per 100g']. Only give me the list. Do not add commentary or personalized responses."
|
| 88 |
LLMResult = askGPT(prompt)
|
| 89 |
lystOfRecipes = LLMResult.split('\n\n')
|
| 90 |
+
print(lystOfRecipes)
|
| 91 |
+
for recipe in range(1,len(lystOfRecipes)-1):
|
| 92 |
+
items.append({"title": lystOfRecipes[recipe].split(":")[0], "content": ""})
|
| 93 |
+
# Display the items with =expanding boxes
|
| 94 |
for item in items:
|
| 95 |
+
#for side bar's item
|
| 96 |
+
#with st.sidebar.expander(item):
|
| 97 |
+
#st.write("man-holding-banana.jpeg")
|
| 98 |
+
#main page items
|
| 99 |
with st.expander(item["title"]):
|
| 100 |
+
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."))
|
| 101 |
|
| 102 |
|
| 103 |
def capture_image():
|