Code Monkey home page Code Monkey logo

flask_tensor_api's Introduction

flask_fensor_api

基于t2t的多语言翻译api框架

将训练好的t2t模型加载到内存并开启api服务

准备

  • python2, tensorflow, tensor2tensor, flask-cors
  • 安装配置tensorflow-serving
  • 将t2t模型导出,与训练目录下的/self_script/self_data上传服务器指定目录
    t2t-exporter \
    --t2t_usr_dir=self_script \
    --problems=my_problem --data_dir=./self_data \ 
    --model=lstm_seq2seq_attention \
    --hparams_set=lstm_attention \
    --output_dir=./train
    
  • 开启tensorflow-server
    tensorflow_model_server \
    --port=9000 \
    --model_name=yourname \
    --model_base_path=~/self_t2t/train/export/Servo
    
    OR tensorflow_model_server –model_config_file=models.json –port=9000
  • 安装tensorflow-serving-api install tensorflow-serving-api

开启api

  • 下载flask_tensor_api到指定目录

  • 编辑conf.py文件

  • 启动服务 gunicorn -c run.py app:app -p ./log/web.pid -D

  • 查看服务 cat ./log/web.pid

参考

https://blog.csdn.net/csa121/article/details/79605215

https://github.com/tensorflow/tensor2tensor/blob/82726e2708f7dd88abdd7c484c5cb7bb86cf7ede/tensor2tensor/serving/README.md

https://spacewander.github.io/explore-flask-zh/5-configuration.html

http://www.pythondoc.com/exploreflask/deployment.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.