Vikas01 commited on
Commit
6e658b5
·
1 Parent(s): bc6695c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -21
app.py CHANGED
@@ -77,28 +77,21 @@ def attend():
77
 
78
  csv_writer = csv.writer(csv_file)
79
 
80
- @app.route('/at')
81
- def webcam(dummy):
82
- # Open the webcam
83
- cap = cv2.VideoCapture(0)
 
 
 
 
 
 
 
 
 
84
 
85
- while True:
86
- # Read frames from the webcam
87
- ret, frame = cap.read()
88
-
89
- # Display the frames in a window
90
- cv2.imshow("Webcam", frame)
91
-
92
- # Break the loop when 'q' is pressed
93
- if cv2.waitKey(1) & 0xFF == ord('q'):
94
- break
95
-
96
- # Release the webcam and close the window
97
- cap.release()
98
- cv2.destroyAllWindows()
99
-
100
- iface = gr.Interface(fn=webcam, inputs=None, outputs="text", title="Webcam")
101
- iface.launch()
102
 
103
 
104
 
 
77
 
78
  csv_writer = csv.writer(csv_file)
79
 
80
+ @app.route('/at')
81
+ def hi():
82
+ def gradio_wrapper(img):
83
+ global model
84
+ print(np.shape(img))
85
+ return img
86
+ demo = gr.Interface(
87
+ gradio_wrapper,
88
+ #gr.Image(source="webcam", streaming=True, flip=True),
89
+ gr.Image(source="webcam", streaming=True),
90
+ "image",
91
+ live=True
92
+ )
93
 
94
+ demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
 
97