Commit
·
9e9b5f0
1
Parent(s):
7349477
Add requirements, update index
Browse files- .env-template +2 -0
- .gitignore +3 -1
- __pycache__/app.cpython-311.pyc +0 -0
- edamam.txt +1 -0
- index.py +7 -9
- requirements.txt +1 -0
.env-template
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
OPENAI_API_KEY =
|
| 2 |
+
EDAMAM_API_KEY =
|
.gitignore
CHANGED
|
@@ -1 +1,3 @@
|
|
| 1 |
-
captured_images/
|
|
|
|
|
|
|
|
|
| 1 |
+
captured_images/
|
| 2 |
+
.venv
|
| 3 |
+
.env
|
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
edamam.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
44f19a04e17d83e91706e4047804e690
|
index.py
CHANGED
|
@@ -23,9 +23,8 @@ st.markdown(background_style, unsafe_allow_html=True)
|
|
| 23 |
# Initialize the session state
|
| 24 |
session_state = st.session_state
|
| 25 |
if 'ingredientsList' not in session_state:
|
| 26 |
-
session_state['ingredientsList'] = []
|
| 27 |
-
|
| 28 |
-
xyz = ["apple", "banana", "orange", "strawberries"]
|
| 29 |
|
| 30 |
def main():
|
| 31 |
# Create two columns
|
|
@@ -82,13 +81,13 @@ def main():
|
|
| 82 |
if st.button("Capture Image"):
|
| 83 |
image_path = capture_image()
|
| 84 |
classification = classifyImage(image_path)
|
| 85 |
-
session_state['ingredientsList'].append(classification)
|
| 86 |
|
| 87 |
# Button to indicate done
|
| 88 |
#done_button = st.sidebar.button('Done')
|
| 89 |
|
| 90 |
# Display the captured ingredients
|
| 91 |
-
#st.write("Captured Ingredients:", session_state['ingredientsList'])
|
| 92 |
|
| 93 |
button_clicked = st.sidebar.button('Done')
|
| 94 |
|
|
@@ -104,13 +103,13 @@ def main():
|
|
| 104 |
# Display the frame in the Streamlit app
|
| 105 |
video_placeholder.image(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), channels="RGB", use_column_width=True)
|
| 106 |
if button_clicked:
|
| 107 |
-
nutrition_values = analyze_nutrition(nutrients(
|
| 108 |
cap.release()
|
| 109 |
if session_state['ingredientsList']:
|
| 110 |
session_state['ingredientsList'].pop()
|
| 111 |
#st.write("Updated Ingredients List:", session_state['ingredientsList'])
|
| 112 |
|
| 113 |
-
displayRecipes(session_state['ingredientsList'])
|
| 114 |
# Define content for each item
|
| 115 |
content = {}
|
| 116 |
for ingredient in nutrition_values:
|
|
@@ -127,7 +126,7 @@ def main():
|
|
| 127 |
with st.sidebar.expander(ingredient):
|
| 128 |
ingred = str(content[ingredient])
|
| 129 |
st.write(ingred[1:len(ingred)-1].replace("'", "").replace(',', '\n\n'))
|
| 130 |
-
|
| 131 |
|
| 132 |
|
| 133 |
|
|
@@ -199,4 +198,3 @@ def nutrients(ingredients):
|
|
| 199 |
|
| 200 |
if __name__ == '__main__':
|
| 201 |
main()
|
| 202 |
-
|
|
|
|
| 23 |
# Initialize the session state
|
| 24 |
session_state = st.session_state
|
| 25 |
if 'ingredientsList' not in session_state:
|
| 26 |
+
session_state['ingredientsList'] = ["apple", "orange", "orange"]
|
| 27 |
+
# xyz = ["apple", "yerba mate", "orange", "orange"]
|
|
|
|
| 28 |
|
| 29 |
def main():
|
| 30 |
# Create two columns
|
|
|
|
| 81 |
if st.button("Capture Image"):
|
| 82 |
image_path = capture_image()
|
| 83 |
classification = classifyImage(image_path)
|
| 84 |
+
#session_state['ingredientsList'].append(classification)
|
| 85 |
|
| 86 |
# Button to indicate done
|
| 87 |
#done_button = st.sidebar.button('Done')
|
| 88 |
|
| 89 |
# Display the captured ingredients
|
| 90 |
+
# st.write("Captured Ingredients:", session_state['ingredientsList'])
|
| 91 |
|
| 92 |
button_clicked = st.sidebar.button('Done')
|
| 93 |
|
|
|
|
| 103 |
# Display the frame in the Streamlit app
|
| 104 |
video_placeholder.image(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB), channels="RGB", use_column_width=True)
|
| 105 |
if button_clicked:
|
| 106 |
+
nutrition_values = analyze_nutrition(nutrients(session_state['ingredientsList']))
|
| 107 |
cap.release()
|
| 108 |
if session_state['ingredientsList']:
|
| 109 |
session_state['ingredientsList'].pop()
|
| 110 |
#st.write("Updated Ingredients List:", session_state['ingredientsList'])
|
| 111 |
|
| 112 |
+
# displayRecipes(session_state['ingredientsList'])
|
| 113 |
# Define content for each item
|
| 114 |
content = {}
|
| 115 |
for ingredient in nutrition_values:
|
|
|
|
| 126 |
with st.sidebar.expander(ingredient):
|
| 127 |
ingred = str(content[ingredient])
|
| 128 |
st.write(ingred[1:len(ingred)-1].replace("'", "").replace(',', '\n\n'))
|
| 129 |
+
displayRecipes(session_state['ingredientsList'])
|
| 130 |
|
| 131 |
|
| 132 |
|
|
|
|
| 198 |
|
| 199 |
if __name__ == '__main__':
|
| 200 |
main()
|
|
|
requirements.txt
CHANGED
|
@@ -19,6 +19,7 @@ platformdirs==2.5.2
|
|
| 19 |
pycparser==2.21
|
| 20 |
pyOpenSSL==21.0.0
|
| 21 |
python-dateutil==2.8.2
|
|
|
|
| 22 |
pytz==2022.1
|
| 23 |
PyYAML==6.0
|
| 24 |
regex==2023.8.8
|
|
|
|
| 19 |
pycparser==2.21
|
| 20 |
pyOpenSSL==21.0.0
|
| 21 |
python-dateutil==2.8.2
|
| 22 |
+
python-dotenv
|
| 23 |
pytz==2022.1
|
| 24 |
PyYAML==6.0
|
| 25 |
regex==2023.8.8
|