def delete_alert(id): session = session_factory() alert_delete = session.query(Alerts).filter(Alerts.id == id).delete() session.commit() return alert_delete
def get_alert(id): session = session_factory() alert_get = session.query(Alerts).filter(Alerts.id == id).first() session.close() return alert_get
def update_alert(id, name): session = session_factory() alert_update = session.query(Alerts).filter(Alerts.id == id).update( {Alerts.name: (name)}) session.commit() return alert_update
#from application.face_recognition.py import face_det from data.database import session_factory from data.model.frame_model import Frames import urllib.request import base64 import sys path = '/home/bruno/cyberTech/grupo3-rep/back-end/' #url_path = 'https://image.freepik.com/fotos-gratis/pessoas-diversas-felizes-unidas_53876-38802.jpg' #img = urllib.request.urlretrieve(url_path, 'pessoas.jpg') session = session_factory() def get_image(): with open(path + 'baby.jpeg', 'rb') as image_file: encoded_string = base64.b64encode(image_file.read()) encoded_string.decode('utf-8') return encoded_string image = get_image() class Frame_dao(): def create_frame(name): # def get_image(img):