Beispiel #1
0
def start_test_server():
    pywebio.enable_debug()
    start_server(target, port=8080, host='127.0.0.1', cdn=False)
    content = img['content']
    nparr = np.fromstring(content, np.uint8)
    img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)

    pred = helper.main(img,model)    
    put_text('Predicted outcome: ',pred)    
    # put_markdown(pred)
    put_image(content)






app.add_url_rule('/tool', 'webio_view', webio_view(predict),
            methods=['GET', 'POST', 'OPTIONS'])
            
# app.run(host='localhost', port=80)


if __name__ == '__main__':
    global model 
    model = helper.load_tflite_model()
    parser = argparse.ArgumentParser()
    parser.add_argument("-p","--port",type=int,default=8080)
    args = parser.parse_args()

    start_server(predict,port=args.port)