Commit
·
2f9ca61
1
Parent(s):
629aaed
Add limit of four
Browse files
index.py
CHANGED
|
@@ -38,8 +38,16 @@ def main():
|
|
| 38 |
|
| 39 |
# Display a placeholder for the video stream
|
| 40 |
video_placeholder = st.empty()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# Button to capture image
|
| 42 |
-
if st.button("Capture Image"):
|
| 43 |
image_path = capture_image()
|
| 44 |
classification = classifyImage(image_path)
|
| 45 |
session_state['ingredientsList'].append(classification)
|
|
@@ -93,8 +101,12 @@ def displayRecipes(ingredientsList):
|
|
| 93 |
LLMResult = askGPT(prompt)
|
| 94 |
lystOfRecipes = LLMResult.split('\n\n')
|
| 95 |
# print(lystOfRecipes)
|
|
|
|
| 96 |
for recipe in range(1,len(lystOfRecipes)-1):
|
|
|
|
| 97 |
items.append({"title": lystOfRecipes[recipe].split(":")[0], "content": ""})
|
|
|
|
|
|
|
| 98 |
# Display the items with =expanding boxes
|
| 99 |
for item in items:
|
| 100 |
#for side bar's item
|
|
@@ -132,6 +144,7 @@ def capture_image():
|
|
| 132 |
|
| 133 |
# Release the VideoCapture and close the OpenCV window
|
| 134 |
cap.release()
|
|
|
|
| 135 |
return image_path
|
| 136 |
|
| 137 |
|
|
|
|
| 38 |
|
| 39 |
# Display a placeholder for the video stream
|
| 40 |
video_placeholder = st.empty()
|
| 41 |
+
|
| 42 |
+
st.markdown("""
|
| 43 |
+
<style>
|
| 44 |
+
[data-testid=stSidebar] {
|
| 45 |
+
background-color: green;
|
| 46 |
+
}
|
| 47 |
+
</style>
|
| 48 |
+
""", unsafe_allow_html=True)
|
| 49 |
# Button to capture image
|
| 50 |
+
if st.button("Capture Image", type="green"):
|
| 51 |
image_path = capture_image()
|
| 52 |
classification = classifyImage(image_path)
|
| 53 |
session_state['ingredientsList'].append(classification)
|
|
|
|
| 101 |
LLMResult = askGPT(prompt)
|
| 102 |
lystOfRecipes = LLMResult.split('\n\n')
|
| 103 |
# print(lystOfRecipes)
|
| 104 |
+
count = 0
|
| 105 |
for recipe in range(1,len(lystOfRecipes)-1):
|
| 106 |
+
count += 1
|
| 107 |
items.append({"title": lystOfRecipes[recipe].split(":")[0], "content": ""})
|
| 108 |
+
if count == 4:
|
| 109 |
+
break
|
| 110 |
# Display the items with =expanding boxes
|
| 111 |
for item in items:
|
| 112 |
#for side bar's item
|
|
|
|
| 144 |
|
| 145 |
# Release the VideoCapture and close the OpenCV window
|
| 146 |
cap.release()
|
| 147 |
+
|
| 148 |
return image_path
|
| 149 |
|
| 150 |
|