Пример #1
0
    def tfi():
        data = request.json
        base64Img = data['encodedImage']

        res = ImgToText(base64Img)

        return ServerMethods.dispatchJSON({ 'equation': res._getEquation() })
Пример #2
0
def bjs():
    data = request.json
    expression = data['expression']

    fExpression, baseFormat = EquationFormating.defFormat(expression)

    res = Evaulute(buildTreeFromExpression(fExpression), baseFormat,
                   fExpression)._getSelf()

    return ServerMethods.dispatchJSON({'base': res})
Пример #3
0
def sya():
    data = request.json
    expression = data['expression']

    res = f'{shuntingYardAlgorithmEvaluation(expression)}'

    return ServerMethods.dispatchJSON({
        'result': res,
        'algorithm': 'shunting yard algorithm'
    })
Пример #4
0
def bte():
    data = request.json
    expression = data['expression']

    fExpression, baseFormat = EquationFormating.defFormat(expression)

    bTree = buildTreeFromExpression(fExpression)
    res = f'{Evaulute._evaluteAndGetOnlyResult(bTree)}'

    return ServerMethods.dispatchJSON({
        'result': res,
        'algorithm': 'binary tree evaluation'
    })
Пример #5
0
 def not_found(e):
     logging.error(e)
     return ServerMethods.dispatchJSON({ 'error': "404 route not found" })
Пример #6
0
 def server_error(e):
     logging.error(e)
     return ServerMethods.dispatchJSON({ 'error': "500 internal error" })
Пример #7
0
 def heartbeat():
     return ServerMethods.dispatchJSON({ 'beat': True })