implemented prompt for the nutrition expert.
Browse files
index.py
CHANGED
|
@@ -2,6 +2,7 @@ import streamlit as st
|
|
| 2 |
import cv2
|
| 3 |
import os
|
| 4 |
from app import *
|
|
|
|
| 5 |
|
| 6 |
# Create a folder to save captured images
|
| 7 |
if not os.path.exists("captured_images"):
|
|
@@ -17,7 +18,11 @@ def main():
|
|
| 17 |
items = ['Item 1', 'Item 2', 'Item 3']
|
| 18 |
|
| 19 |
#list to of Ingredients camptured
|
|
|
|
| 20 |
ingredientsList =[] #list()
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Define content for each item
|
| 23 |
content = {
|
|
@@ -85,15 +90,17 @@ def displayRecipes(ingredientsList):
|
|
| 85 |
st.write(item["content"])
|
| 86 |
#now we are gonna send the ingredient list to ask gpt
|
| 87 |
prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
|
| 88 |
-
Ingredients? give me possible
|
| 89 |
-
|
| 90 |
-
|
|
|
|
| 91 |
LLMResult = askGPT(prompt)
|
| 92 |
-
print(LLMResult)
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
|
| 95 |
-
|
| 96 |
-
|
| 97 |
def capture_image(cap):
|
| 98 |
# Read a frame from the webcam
|
| 99 |
ret, frame = cap.read()
|
|
|
|
| 2 |
import cv2
|
| 3 |
import os
|
| 4 |
from app import *
|
| 5 |
+
import json
|
| 6 |
|
| 7 |
# Create a folder to save captured images
|
| 8 |
if not os.path.exists("captured_images"):
|
|
|
|
| 18 |
items = ['Item 1', 'Item 2', 'Item 3']
|
| 19 |
|
| 20 |
#list to of Ingredients camptured
|
| 21 |
+
<<<<<<< HEAD
|
| 22 |
ingredientsList =[] #list()
|
| 23 |
+
=======
|
| 24 |
+
ingredientsList =["apple", "orange", "mango", "potato", "cabbage", "carrot", "lentils"] #list()
|
| 25 |
+
>>>>>>> 37e4918 (implemented prompt for the nutrition expert.)
|
| 26 |
|
| 27 |
# Define content for each item
|
| 28 |
content = {
|
|
|
|
| 90 |
st.write(item["content"])
|
| 91 |
#now we are gonna send the ingredient list to ask gpt
|
| 92 |
prompt = f"I have following Ingredients :{','.join(ingredientsList)}. What can I make with these \
|
| 93 |
+
Ingredients? give me possible possible list of recipes with Nutrition Facts per 100g from\
|
| 94 |
+
highest nutrition value to lowest. Give me results in \
|
| 95 |
+
json format in the following format:\
|
| 96 |
+
['title': 'Recipe title', 'content': 'recipe and nutritional facts per 100g']"
|
| 97 |
LLMResult = askGPT(prompt)
|
| 98 |
+
print(type(LLMResult))
|
| 99 |
+
json_object = json.loads(LLMResult)
|
| 100 |
+
print(type(json_object))
|
| 101 |
+
print(json_object)
|
| 102 |
|
| 103 |
|
|
|
|
|
|
|
| 104 |
def capture_image(cap):
|
| 105 |
# Read a frame from the webcam
|
| 106 |
ret, frame = cap.read()
|