bokharim24 commited on
Commit
abd6949
·
2 Parent(s): 3200dde d761c26

Merge branch 'main' of https://huggingface.co/threeidots/SpeakClear

Browse files
Files changed (1) hide show
  1. index.py +48 -4
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.title('🧑🏽‍🍳 RecipeBud')
19
-
 
 
 
 
 
 
 
 
 
 
20
  st.sidebar.header('Ingredients & Nutrition')
21
  # List of items
22
  #items = ['Item 1', 'Item 2', 'Item 3']
@@ -38,6 +61,22 @@ 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()
@@ -88,13 +127,17 @@ def displayRecipes(ingredientsList):
88
  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 \
89
  highest nutritional value to lowest. Give me results in \
90
  following format and do not deviate from this format:\
91
- ['Recipe Title', 'content of recipe and nutritional facts per 100g']. Only give me the list. Do not add commentary or personalized responses. Keep it under 200 words."
92
  #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."
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 +175,7 @@ def capture_image():
132
 
133
  # Release the VideoCapture and close the OpenCV window
134
  cap.release()
 
135
  return image_path
136
 
137
 
 
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']
 
61
 
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()
 
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')
134
  # print(lystOfRecipes)
135
+ count = 0
136
  for recipe in range(1,len(lystOfRecipes)-1):
137
+ count += 1
138
  items.append({"title": lystOfRecipes[recipe].split(":")[0], "content": ""})
139
+ if count == 4:
140
+ break
141
  # Display the items with =expanding boxes
142
  for item in items:
143
  #for side bar's item
 
175
 
176
  # Release the VideoCapture and close the OpenCV window
177
  cap.release()
178
+
179
  return image_path
180
 
181