Commit
·
a3a4b43
1
Parent(s):
5efdb6c
Taking images and classifying them as soon as the capture image button is pressed
Browse files- __pycache__/app.cpython-311.pyc +0 -0
- index.py +5 -2
__pycache__/app.cpython-311.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
|
|
|
index.py
CHANGED
|
@@ -9,7 +9,6 @@ if not os.path.exists("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 |
|
|
@@ -41,7 +40,9 @@ def main():
|
|
| 41 |
|
| 42 |
# Button to capture image
|
| 43 |
if st.button("Capture Image"):
|
| 44 |
-
capture_image(cap)
|
|
|
|
|
|
|
| 45 |
|
| 46 |
while True:
|
| 47 |
# Read a frame from the webcam
|
|
@@ -84,6 +85,8 @@ def capture_image(cap):
|
|
| 84 |
image_path = f"captured_images/captured_image_{len(os.listdir('captured_images')) + 1}.jpg"
|
| 85 |
cv2.imwrite(image_path, cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
| 86 |
st.success(f"Image captured and saved as {image_path}")
|
|
|
|
|
|
|
| 87 |
|
| 88 |
if __name__ == '__main__':
|
| 89 |
main()
|
|
|
|
| 9 |
|
| 10 |
def main():
|
| 11 |
st.title('Image Capture App')
|
|
|
|
| 12 |
|
| 13 |
st.sidebar.header('Ingredients & Nutrition')
|
| 14 |
|
|
|
|
| 40 |
|
| 41 |
# Button to capture image
|
| 42 |
if st.button("Capture Image"):
|
| 43 |
+
image_path = capture_image(cap)
|
| 44 |
+
print(classifyImage(image_path))
|
| 45 |
+
|
| 46 |
|
| 47 |
while True:
|
| 48 |
# Read a frame from the webcam
|
|
|
|
| 85 |
image_path = f"captured_images/captured_image_{len(os.listdir('captured_images')) + 1}.jpg"
|
| 86 |
cv2.imwrite(image_path, cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
| 87 |
st.success(f"Image captured and saved as {image_path}")
|
| 88 |
+
return image_path
|
| 89 |
+
|
| 90 |
|
| 91 |
if __name__ == '__main__':
|
| 92 |
main()
|