Skip to main content

Simple Model Deploy Restful Api!

Project description

:rocket: RestfulApi :facepunch:


模型部署

Install

pip install restful_api -U

Usage

import jieba
from restful_api import Api


pred1 = lambda **kwargs: kwargs['x'] + kwargs['y']
pred2 = lambda x=1, y=1: x + y
pred3 = lambda text='小米是家不错的公司': jieba.lcut(text)

# 多服务堆叠
api = Api('/post1', pred1)
api = Api('/post2', pred2, app=api.app)
api = Api('/post3', pred3, app=api.app)
api.app.run()

Test

import requests
json = {'x': 1, 'y': 10}
requests.post('http://127.0.0.1:5000/post1', json=json).json()
requests.post('http://127.0.0.1:5000/post2', json=json).json()
requests.post('http://127.0.0.1:5000/post3', json=json).json()

Project details


Download files

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

Source Distribution

restful_api-0.0.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

restful_api-0.0.4-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file restful_api-0.0.4.tar.gz.

File metadata

  • Download URL: restful_api-0.0.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for restful_api-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8d737546edbfc6cfd785e83c5dfae7ad01fb786c8f5b260fd8dffc409d3d7812
MD5 45cbe668b6fc9cb00c196ddf9adad0d7
BLAKE2b-256 6ebfe8ae5bdc5076c265ee143c365963253e2bf8ff3530727f9e9cec2d2e7e06

See more details on using hashes here.

File details

Details for the file restful_api-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: restful_api-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for restful_api-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 00675dd6ffb6708694ec35bd0c7098379e0d43218973c2f0d67bfe724f9527ee
MD5 7a47de7bccad91c9df90d814fcfd0171
BLAKE2b-256 360a2039b07db068f1557b5917068ca4de83baff5ce7ddb5ccfe1521b678d45c

See more details on using hashes here.

Supported by

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