Vikas01 commited on
Commit
610c419
·
1 Parent(s): 7113bd9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -14,7 +14,7 @@ import matplotlib.pyplot as plt
14
 
15
  import io
16
  import streamlit as st
17
-
18
 
19
 
20
 
@@ -77,23 +77,25 @@ def attend():
77
 
78
  csv_writer = csv.writer(csv_file)
79
 
80
-
81
  @app.route('/at')
82
  def cam():
83
- bytes_data=None
84
- img_file_buffer=st.camera_input("Take a picture")
 
 
 
 
85
  if img_file_buffer is not None:
86
-
87
  test_image = Image.open(img_file_buffer)
88
  st.image(test_image, use_column_width=True)
89
  st.write(type(test_image))
90
  image = np.asarray(test_image)
91
- gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
92
  st.image(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
93
  if bytes_data is None:
94
- st.stop()
95
 
96
- return render_template('attendance.html')
97
 
98
 
99
 
 
14
 
15
  import io
16
  import streamlit as st
17
+ from streamlit.server.server import Server
18
 
19
 
20
 
 
77
 
78
  csv_writer = csv.writer(csv_file)
79
 
 
80
  @app.route('/at')
81
  def cam():
82
+ return render_template('attendance.html')
83
+
84
+ def main():
85
+ server = Server.get_current()
86
+ img_file_buffer = server.uploaded_file_mgr.get_file('img_file_buffer')
87
+ bytes_data = None
88
  if img_file_buffer is not None:
 
89
  test_image = Image.open(img_file_buffer)
90
  st.image(test_image, use_column_width=True)
91
  st.write(type(test_image))
92
  image = np.asarray(test_image)
93
+ gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
94
  st.image(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
95
  if bytes_data is None:
96
+ st.stop()
97
 
98
+ return render_template('attendance.html')
99
 
100
 
101