You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB
Python

#!/home//agropunx/anaconda3/envs/geografia/bin/python
#Import necessary librarie
from flask import Flask, render_template, request, Response, redirect,session
from flask_bootstrap import Bootstrap
import cv2, sys, os
di=os.path.dirname(os.path.abspath(__file__))
#sys.path.append('/'.join(di.split('/')[:-1]))
cur_dir = os.getcwd().split('/')[-1]
if cur_dir=='geografia':
sys.path.append('/'.join(di.split('/')[:-2]))
from colemano.src import colemano as clm
from colemano.src.config import *
else:
sys.path.append('/'.join(di.split('/')[:-1]))
from src import colemano as clm
from src.config import *
#Initialize the Flask app
app = Flask(__name__)
coso = clm.ColeMano()
@app.route('/',methods=['GET','POST'])
def index():
if ' ON ' in request.args:
coso.ison = True
elif 'OFF&RESET' in request.args:
coso.ison = False
coso.firstFrame = None
return render_template('index.html')
@app.route('/colemano_routine',methods=['GET','POST'])
def colemano_routine():
return Response(coso.flask_routine(), mimetype='multipart/x-mixed-replace; boundary=frame')
if __name__ == '__main__':
try:
app.run(debug=True)
except:
cv2.destroyAllWindows()
finally:
cv2.destroyAllWindows()