Spaces:
Sleeping
Sleeping
piyushaaryan011
commited on
Commit
·
6d1df93
1
Parent(s):
2b3e585
camera
Browse files
app.py
CHANGED
@@ -1,4 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
|
|
3 |
x = st.slider('Select a value')
|
4 |
-
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import cv2
|
3 |
+
import numpy as np
|
4 |
x = st.slider('Select a value')
|
5 |
+
st.write(x, 'squared is', x * x)
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
img_file_buffer = st.camera_input("Take a picture")
|
10 |
+
|
11 |
+
if img_file_buffer is not None:
|
12 |
+
# To read image file buffer with OpenCV:
|
13 |
+
bytes_data = img_file_buffer.getvalue()
|
14 |
+
cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
|
15 |
+
|
16 |
+
# Check the type of cv2_img:
|
17 |
+
# Should output: <class 'numpy.ndarray'>
|
18 |
+
st.write(type(cv2_img))
|
19 |
+
|
20 |
+
# Check the shape of cv2_img:
|
21 |
+
# Should output shape: (height, width, channels)
|
22 |
+
st.write(cv2_img.shape)
|