thinh-huynh-re commited on
Commit
68f1278
1 Parent(s): e1e899c
Files changed (2) hide show
  1. app.py +0 -1
  2. camera.py +18 -0
app.py CHANGED
@@ -116,7 +116,6 @@ st.title("TimeSFormer")
116
  with st.expander("INTRODUCTION"):
117
  st.text(
118
  f"""Streamlit demo for TimeSFormer.
119
- Author: Hiep Phuoc Secondary High School
120
  Number of CPU(s): {multiprocessing.cpu_count()}
121
  """
122
  )
 
116
  with st.expander("INTRODUCTION"):
117
  st.text(
118
  f"""Streamlit demo for TimeSFormer.
 
119
  Number of CPU(s): {multiprocessing.cpu_count()}
120
  """
121
  )
camera.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import cv2
3
+ import numpy as np
4
+
5
+ img_file_buffer = st.camera_input("Take a picture")
6
+
7
+ if img_file_buffer is not None:
8
+ # To read image file buffer with OpenCV:
9
+ bytes_data = img_file_buffer.getvalue()
10
+ cv2_img = cv2.imdecode(np.frombuffer(bytes_data, np.uint8), cv2.IMREAD_COLOR)
11
+
12
+ # Check the type of cv2_img:
13
+ # Should output: <class 'numpy.ndarray'>
14
+ st.write(type(cv2_img))
15
+
16
+ # Check the shape of cv2_img:
17
+ # Should output shape: (height, width, channels)
18
+ st.write(cv2_img.shape)