def indexa(): data.a._stop_recording() sleep(2) model = Model_Detect data.a = Run_Server(model) #only by sending this page first will the client be connected to the socketio instance return render_template('sanic.html')
def detect_route(): data.a._stop_recording() sleep(2) model = Model_Detect data.a = Run_Server(model) if request.headers.get('accept') == 'text/event-stream': return Response(svg(), content_type='text/event-stream') return render_template('index.html')
app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' app.config['DEBUG'] = True app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 class DataStore(): a = None c = None data = DataStore() model = Model_Detect data.a = Run_Server(model) def checkClient(q, qu): while True: img = data.a.image()[0] svg = data.a.image()[1] q.put(img) qu.put(svg) sleep(.001) q = queue.Queue(maxsize=2) qu = queue.Queue(maxsize=2)