Merge branch 'main' of https://huggingface.co/threeidots/SpeakClear
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- index.py +13 -29
__pycache__/app.cpython-311.pyc
ADDED
|
Binary file (1.35 kB). View file
|
|
|
index.py
CHANGED
|
@@ -1,44 +1,29 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import cv2
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
# Create a folder to save captured images
|
| 6 |
if not os.path.exists("captured_images"):
|
| 7 |
os.makedirs("captured_images")
|
| 8 |
|
| 9 |
def main():
|
| 10 |
-
st.title('
|
|
|
|
| 11 |
|
| 12 |
st.sidebar.header('Ingredients & Nutrition')
|
| 13 |
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
'Orange': "80 kcal/each"
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
# Display expanders for each item
|
| 26 |
-
for item in items:
|
| 27 |
-
with st.sidebar.expander(item):
|
| 28 |
-
st.write(content[item])
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
done_clicked = st.sidebar.button('Done')
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
if done_clicked:
|
| 35 |
displayRecipes()
|
| 36 |
|
| 37 |
-
|
| 38 |
-
if not done_clicked:
|
| 39 |
-
vidCapture()
|
| 40 |
|
| 41 |
-
def vidCapture():
|
| 42 |
# Create a VideoCapture object to access the webcam
|
| 43 |
cap = cv2.VideoCapture(0)
|
| 44 |
|
|
@@ -55,8 +40,7 @@ def vidCapture():
|
|
| 55 |
video_placeholder = st.empty()
|
| 56 |
|
| 57 |
# Button to capture image
|
| 58 |
-
|
| 59 |
-
if capture_button_clicked:
|
| 60 |
capture_image(cap)
|
| 61 |
|
| 62 |
while True:
|
|
@@ -73,9 +57,8 @@ def vidCapture():
|
|
| 73 |
# Release the VideoCapture and close the OpenCV window
|
| 74 |
cap.release()
|
| 75 |
|
| 76 |
-
|
| 77 |
def displayRecipes():
|
| 78 |
-
|
| 79 |
items = [
|
| 80 |
{"title": "Recipe 1", "content": "Content for Item 1."},
|
| 81 |
{"title": "Recipe 2", "content": "Content for Item 2."},
|
|
@@ -88,6 +71,7 @@ def displayRecipes():
|
|
| 88 |
st.write(item["content"])
|
| 89 |
|
| 90 |
|
|
|
|
| 91 |
def capture_image(cap):
|
| 92 |
# Read a frame from the webcam
|
| 93 |
ret, frame = cap.read()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import cv2
|
| 3 |
import os
|
| 4 |
+
from app import classifyImage
|
| 5 |
|
| 6 |
# Create a folder to save captured images
|
| 7 |
if not os.path.exists("captured_images"):
|
| 8 |
os.makedirs("captured_images")
|
| 9 |
|
| 10 |
def main():
|
| 11 |
+
st.title('Image Capture App')
|
| 12 |
+
print(classifyImage("/Users/danishbokhari/Desktop/SpeakClear/captured_images/banaana.jpeg"))
|
| 13 |
|
| 14 |
st.sidebar.header('Ingredients & Nutrition')
|
| 15 |
|
| 16 |
|
| 17 |
+
option1 = st.sidebar.checkbox('Banana')
|
| 18 |
+
option2 = st.sidebar.checkbox('Strawberry')
|
| 19 |
+
option3 = st.sidebar.checkbox('Kale')
|
| 20 |
+
option4 = st.sidebar.checkbox('Orange Juice')
|
| 21 |
+
option5 = st.sidebar.checkbox('Almond Milk')
|
| 22 |
+
button_clicked = st.sidebar.button('Done')
|
| 23 |
+
if button_clicked:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
displayRecipes()
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
|
|
|
|
| 27 |
# Create a VideoCapture object to access the webcam
|
| 28 |
cap = cv2.VideoCapture(0)
|
| 29 |
|
|
|
|
| 40 |
video_placeholder = st.empty()
|
| 41 |
|
| 42 |
# Button to capture image
|
| 43 |
+
if st.button("Capture Image"):
|
|
|
|
| 44 |
capture_image(cap)
|
| 45 |
|
| 46 |
while True:
|
|
|
|
| 57 |
# Release the VideoCapture and close the OpenCV window
|
| 58 |
cap.release()
|
| 59 |
|
| 60 |
+
|
| 61 |
def displayRecipes():
|
|
|
|
| 62 |
items = [
|
| 63 |
{"title": "Recipe 1", "content": "Content for Item 1."},
|
| 64 |
{"title": "Recipe 2", "content": "Content for Item 2."},
|
|
|
|
| 71 |
st.write(item["content"])
|
| 72 |
|
| 73 |
|
| 74 |
+
|
| 75 |
def capture_image(cap):
|
| 76 |
# Read a frame from the webcam
|
| 77 |
ret, frame = cap.read()
|