def filePath(): data = request.json imgurl = data[4] dataPath = imgurl[22:] imagedata = base64.b64decode(dataPath) if (os.path.exists(args.PATH_DATA + 'picture.jpg')): os.remove(args.PATH_DATA + 'picture.jpg') file = open(args.PATH_DATA + 'picture.jpg', "wb") file.write(imagedata) file.close() data[4] = args.PATH_DATA + 'picture.jpg' print(data) model.main(data, args.PATH_RESULTS, args.PATH_DATA, args.PATH_STYLE, args.PATH_MODEL) imgPath = [1] return jsonify(results=[imgPath])
def photograph(): data = request.json imgurl = data[5] dataPath = imgurl[22:] imagedata = base64.b64decode(dataPath) if (os.path.exists(args.PATH_DATA + 'touxiang.jpg')): os.remove(args.PATH_DATA + 'touxiang.jpg') file = open(args.PATH_DATA + 'touxiang.jpg', 'wb') file.write(imagedata) file.close() data[4] = args.PATH_DATA + 'touxiang.jpg' model.main(data, args.PATH_RESULTS, args.PATH_DATA, args.PATH_STYLE, args.PATH_MODEL) imgPath = [1] return jsonify(results=[imgPath])
from core.app import main if __name__ == "__main__": main()