Commit
·
d761c26
1
Parent(s):
2f9ca61
Set background and logo
Browse files
index.py
CHANGED
|
@@ -7,6 +7,19 @@ from app import *
|
|
| 7 |
if not os.path.exists("captured_images"):
|
| 8 |
os.makedirs("captured_images")
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Initialize the session state
|
| 11 |
session_state = st.session_state
|
| 12 |
if 'ingredientsList' not in session_state:
|
|
@@ -14,9 +27,19 @@ if 'ingredientsList' not in session_state:
|
|
| 14 |
#["apple", "banana", "orange", "strawberries"]
|
| 15 |
|
| 16 |
def main():
|
| 17 |
-
|
| 18 |
-
st.
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
st.sidebar.header('Ingredients & Nutrition')
|
| 21 |
# List of items
|
| 22 |
#items = ['Item 1', 'Item 2', 'Item 3']
|
|
@@ -39,15 +62,23 @@ def main():
|
|
| 39 |
# Display a placeholder for the video stream
|
| 40 |
video_placeholder = st.empty()
|
| 41 |
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
# Button to capture image
|
| 50 |
-
if st.button("Capture Image"
|
| 51 |
image_path = capture_image()
|
| 52 |
classification = classifyImage(image_path)
|
| 53 |
session_state['ingredientsList'].append(classification)
|
|
@@ -96,7 +127,7 @@ def displayRecipes(ingredientsList):
|
|
| 96 |
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 \
|
| 97 |
highest nutritional value to lowest. Give me results in \
|
| 98 |
following format and do not deviate from this format:\
|
| 99 |
-
['Recipe Title', '
|
| 100 |
#prompt = f"You are going to act as a nutritional expert who has a lot of knowledge about food. I have the following ingredients: {','.join(ingredientsList)}. What can I make with these ingredients? Give me a list of names of recipes, maximum five."
|
| 101 |
LLMResult = askGPT(prompt)
|
| 102 |
lystOfRecipes = LLMResult.split('\n\n')
|
|
|
|
| 7 |
if not os.path.exists("captured_images"):
|
| 8 |
os.makedirs("captured_images")
|
| 9 |
|
| 10 |
+
background_style = """
|
| 11 |
+
<style>
|
| 12 |
+
[data-testid="stAppViewContainer"] {
|
| 13 |
+
background-image: url('https://i.ibb.co/HpYr6qg/Untitled-design-2.png');
|
| 14 |
+
background-size: cover;
|
| 15 |
+
background-repeat: no-repeat;
|
| 16 |
+
background-attachment: fixed;
|
| 17 |
+
}
|
| 18 |
+
</style>
|
| 19 |
+
"""
|
| 20 |
+
st.markdown(background_style, unsafe_allow_html=True)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
# Initialize the session state
|
| 24 |
session_state = st.session_state
|
| 25 |
if 'ingredientsList' not in session_state:
|
|
|
|
| 27 |
#["apple", "banana", "orange", "strawberries"]
|
| 28 |
|
| 29 |
def main():
|
| 30 |
+
# Create two columns
|
| 31 |
+
col1, col2 = st.columns([1, 5])
|
| 32 |
+
|
| 33 |
+
# In the first column, display the title
|
| 34 |
+
with col1:
|
| 35 |
+
logo = st.image("https://d112y698adiu2z.cloudfront.net/photos/production/software_thumbnail_photos/002/589/585/datas/medium.png", width=150)
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# In the second column, display the logo image
|
| 40 |
+
with col2:
|
| 41 |
+
st.title('RecipeBud')
|
| 42 |
+
|
| 43 |
st.sidebar.header('Ingredients & Nutrition')
|
| 44 |
# List of items
|
| 45 |
#items = ['Item 1', 'Item 2', 'Item 3']
|
|
|
|
| 62 |
# Display a placeholder for the video stream
|
| 63 |
video_placeholder = st.empty()
|
| 64 |
|
| 65 |
+
# Apply custom CSS for the button
|
| 66 |
+
st.markdown(
|
| 67 |
+
"""
|
| 68 |
+
<style>
|
| 69 |
+
.stButton>button {
|
| 70 |
+
background-color: #4CAF50; /* Green */
|
| 71 |
+
color: white;
|
| 72 |
+
border: none;
|
| 73 |
+
border-radius: 5px;
|
| 74 |
+
}
|
| 75 |
+
</style>
|
| 76 |
+
""",
|
| 77 |
+
unsafe_allow_html=True
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
# Button to capture image
|
| 81 |
+
if st.button("Capture Image"):
|
| 82 |
image_path = capture_image()
|
| 83 |
classification = classifyImage(image_path)
|
| 84 |
session_state['ingredientsList'].append(classification)
|
|
|
|
| 127 |
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 \
|
| 128 |
highest nutritional value to lowest. Give me results in \
|
| 129 |
following format and do not deviate from this format:\
|
| 130 |
+
['Recipe Title', 'nutritional facts per serving and content of recipe']."
|
| 131 |
#prompt = f"You are going to act as a nutritional expert who has a lot of knowledge about food. I have the following ingredients: {','.join(ingredientsList)}. What can I make with these ingredients? Give me a list of names of recipes, maximum five."
|
| 132 |
LLMResult = askGPT(prompt)
|
| 133 |
lystOfRecipes = LLMResult.split('\n\n')
|