-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py.save
52 lines (40 loc) · 1.2 KB
/
test.py.save
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from app import Detect, Classify, Teachable, Empty, pose_camera, anonymizer, synthesizer
from flask import Flask, send_file, Response, render_template
from app.Cam import camera
import keyboard
from time import sleep
from threading import Thread, active_count
import signal
from threading import Thread, Event
from threading import Thread
import sys
app = Flask(__name__)
#Image = camera(pose_camera.AI())
#Image = camera(Teachable.AI())
#Image = camera(Classify.AI())
#Image = camera(Detect.AI())
#Image = camera(Empty.AI())
@app.route('/')
def index():
return render_template('index.html')
@app.route('/video_feed')
def video_feed():
return Response(Image.ImageStream(), mimetype='multipart/x-mixed-replace; boundary=frame')
def flaskServer():
app.run(host="0.0.0.0", debug=False)
def signal_handler(signal, frame):
print("\nprogram exiting gracefully")
sys.exit(0)
def Robot_code():
while True:
sleep(0.01)
result = Image.result
print('result')
if __name__ == "__main__":
global status
thread = Thread(target=flaskServer)
thread.start()
# = Thread(target=Robot_code)
#thread5.start()
sleep(2)
signal.signal(signal.SIGINT, signal_handler)