Skip to main content

A web server for deploy ml/dl model

Project description

介绍

fastml-engine. 采用Gunicorn Web服务框架搭建,以简化模型推理工程部署的工作内容

功能特性

  1. 集成Gunicorn Flask 服务组件,稳定可靠,可用于生产.

  2. 统一推理服务接口,支持多种接口请求格式(text/json/octet-stream/form-data)

  3. 搭配inference-template使用,支持自定义模型推理代码

  4. 支持简便的启动命令

安装

pip install fastml-engine

使用说明

  1. 下载 inference-template-python 代码地址

  2. 启动服务

    fastml server --help  #查看帮助
    #service_path参数为inference-template-python目录的绝对路径
    fastml server --service-path /home/<service_path> --host 0.0.0.0 --port 5000
    #在未声明service-path参数的情况下,则使用当前命令执行路径
    fastml server --host 0.0.0.0 --port 5000
    #支持定义 model-path参数声明模型存放路径,未声明则默认使用<service-path>/model
    fastml server --service-path /home/<service_path> --model-path /opt/model --host 0.0.0.0 --port 5000
    #快速启动,执行如下命令,采用默认参数
    fastml server
  3. 验证服务
    a)通过浏览器访问健康检查接口 ip:port/health
    b)查看启动日志,日志目录在代码根路径/logs目录下

API接口

接口说明

URI

请求协议

返回内容

健康检查

/health

GET

{ status:UP}

推理接口

/algo/{endpoint}

POST

返回预测结果

健康检查接口响应报文

{
  "status": "UP"
}

推理接口响应报文
{
   "status": true,
   "data": {
      "k": "v"
   },
   "metadata": {
      "duration": 1.65576171875,
      "content_type": "json"
   }
}

测试

注意:请求头需要添加Content-Type参数,用来指定请求报文格式

Content-Type

说明

text/plain

文本格式

application/json

json格式

application/octet-stream

文件

multipart/form-data

form-data格式

日志

运行日志存放在推理引擎根目录logs文件夹下

  1. access.log为请求调用日志

  2. error-access.log为错误日志

  3. app.log为业务日志,使用python logging模块打印

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastml_engine-1.0.7-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file fastml_engine-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: fastml_engine-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.9.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for fastml_engine-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4b576d9aba498f3cf1abf2bc1f29dd525954ebd112242deb084214a32980d463
MD5 fff0fb1af9b0e87d85b6c08da7e87b7d
BLAKE2b-256 54da95b18b4beb1185e5b8289a7d568d272b2014c206ce1eab23b11499cbd42f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page